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

Add ParseResult::contains method #440

Merged
merged 1 commit into from
Oct 23, 2024
Merged

Conversation

levonwaveye
Copy link
Contributor

@levonwaveye levonwaveye commented Oct 14, 2024

Adds a method imitating C++20 std::map contains method for ParseResult. This makes certain syntax more concise:

    options.add_options()
    ...
        ("d,debug", "Enable debugging")
    ...    
    ;

    bool debug = result.contains("debug");

Obviously this is syntactic sugar for static_cast<bool>(count()) but just like with std::map this is common enough of a use case to be worth adding.


This change is Reviewable

@jarro2783 jarro2783 merged commit 10a7a64 into jarro2783:master Oct 23, 2024
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants