-
Notifications
You must be signed in to change notification settings - Fork 361
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
Support for enumerations #12
Comments
I'm curious, what do you expect for the interface? I'll have to see why the SFINAE is selecting the string version for a enum that just wraps an int, though, that should not be happening.
|
By the way, there is no need to wrap the first couple of lines with |
The first version (i.e. -l 0) and it would be useful if the help message outputted something like this:
|
C++ can't capture the names of enumerations. See this question. You can manually set that in your help string, though. |
Current implementation: Level level;
app.add_set("-l,--level", level, {High, Medium, Low}, "Level settings")
->set_type_name("enum/Level in {High=0, Medium=1, Low=2}");
May think about this a little more. Still need to add a few tests. |
This issue is closed, but I think it would be nice if we could support enums with string identifiers instead integers. I am currently using
|
I'd prefer (I think) a custom class in CLI11 that would support this. Something like |
I also tried overloading literal_cast, but it wasn't effective, probably because I didn't define it early enough or so. |
Okay, with IsMember mapping and built-in support for enums, I think this is finally part of CLI11, headed for 1.8! |
I tried the following code to see whether CLI11 supports the use of enumerations in
add_set
and got a series of errors. Is the code wrong is support for enumerations planned/not going to be added?Errors:
The text was updated successfully, but these errors were encountered: