Reputation: 12279
How does boost::program_options
parse or manage an input when both multitoken and positional options are allowed?
For example:
./app.sample pos1 --multitokenoption a b c d pos2
How does boost know when a multitokenoption
finishes and a positional option begins?
Obviously, the most logical allowed behaviour would be that a multitoken option must be present as last parameter, just as happens with default arguments in function parameters, but the documentation says nothing about it.
Upvotes: 5
Views: 3430
Reputation: 4191
There are three way to mark the end of values for a multitoken option:
Another option:
./app.sample pos1 --multitokenoption a b c d --regularoption v pos2
Option name for the positional option (almost the #1):
./app.sample pos1 --multitokenoption a b c d --pos2 pos2
Double-dash:
./app.sample pos1 --multitokenoption a b c d -- pos2
Otherwise the multi-token option won't know where to stop - nothing magical.
Upvotes: 6