cxxopts icon indicating copy to clipboard operation
cxxopts copied to clipboard

Add ParseResult::contains method

Open levonwaveye opened this issue 4 months ago • 0 comments

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

levonwaveye avatar Oct 14 '24 02:10 levonwaveye