Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Constructing arg with a callable sometimes picks the wrong overload #94

Open
mknejp opened this issue Jun 6, 2024 · 1 comment
Open
Labels
bug Something isn't working

Comments

@mknejp
Copy link

mknejp commented Jun 6, 2024

The constraints put on the constructors of bound_parser seem to be different from opt, as the latter works in all these scenarios.

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

@mknejp
Copy link
Author

mknejp commented Jun 6, 2024

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.

@mknejp mknejp changed the title Cosntructing arg with a callable sometimes picks the wrong overload Constructing arg with a callable sometimes picks the wrong overload Jun 6, 2024
@grafikrobot grafikrobot added the bug Something isn't working label Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: 🆕 New
Development

No branches or pull requests

2 participants