Open mknejp opened 3 months ago
The constraints put on the constructors of bound_parser seem to be different from opt, as the latter works in all these scenarios.
bound_parser
opt
Works:
lyra::arg([](std::string) {}, "hint");
Does not work:
auto f = [](std::string) {}; lyra::arg(f, "hint");
auto f = std::function<void(std::string)>{}; lyra::arg(f, "hint");
They both cause compile errors as they attempt to stream into/out of the function object.
https://godbolt.org/z/W8M7Tb687
Update: it seems to be related to the value category of the callable as
auto f = std::function<void(std::string)>{}; lyra::arg(std::move(f), "hint");
works.
The constraints put on the constructors of
bound_parser
seem to be different fromopt
, as the latter works in all these scenarios.Works:
Does not work:
They both cause compile errors as they attempt to stream into/out of the function object.
https://godbolt.org/z/W8M7Tb687