-
Notifications
You must be signed in to change notification settings - Fork 592
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
Extend cxxopts API to support std::optional non-throwing query of values #421
Conversation
Thanks for your PR. I will take a look properly when I get a chance in a couple of days. |
No rush. We're having some interesting internal discussion. |
This looks good, I'm also thinking about whether there is a better name for the function. I wonder if there some convention from other projects like something with |
What do you think about calling it |
I was thinking of It turns out that std::make_optional does already exist too. (News to me!) |
I understand your reasoning with maybe but isn't that just a synonym for optional? |
Or |
Yes, |
Updated as discussed. |
We have some internal usage of
std::optional
that can integrate very tidily with cxxopts providing this query forstd::optional
value of given name and type.No need for an if-check of
count
or catching an exception.This change is