catchorg / Clara

A simple to use, composable, command line parser for C++ 11 and beyond
Boost Software License 1.0
650 stars 67 forks source link

remainingTokens is not accessible after parsing #77

Open vogel opened 5 years ago

vogel commented 5 years ago

I was trying to extract remainingTokens from InternalParseResult from failed parse, but I was not able to. It seems that remainingTokens are a pair of iterators that are no longer valid after Parser::parse() method was finished.

I think it means that return value of Parser::parser() has wrong return type, as it gives access to variables that cannot be accessed. It could be fixed by either changing the return type, make variables valid at that point, or add a new TokenStream/std::vector member to Parser class that will contain remainingTokens after parse() is finished.

I've ended up with implementing my own class from Parser that does the last thing.

Please let me know what do you think about it (nb.: in some previous version of clara those values were easily accessible by unusedTokens() method).