"Chris Weed" writes:
I am at a loss of how to do that. Hopefully someone else can give you a hand. Chris
On 6/12/07, Bryan Green
wrote: "Chris Weed" writes:
On 6/12/07, Bryan Green
wrote: Hello,
Is there a mechanism in boost::program_options for supporting optional arguments? If not, is there a suggested program_options-based alternat ive?
What exactly do you mean by optional arguments? Do you mean like this? http://www.boost.org/doc/html/program_options/howto.html#id1593176
Chris
The quotation in my email goes into exact detail - basically, I'm looking for functionality equivalent to GNU getopt_long, which has an "optional_argument" specifier. It is a method for optionally associating a value with a particular option. For example, if I specify a getopt_long parameter to enable listening on a socket:
{"listen",optional_argument,NULL,'l'}
Then, on the command line, '--listen' means to enable listening, using a default port number. '--listen=5000' means enable listening, using port number 5000.
The only way I see to accomplish this with program_options is to make a second option called "listen_port".
I've discovered that this does not work either, because if you try to specify the '--listen' option, it complains that it is ambiguous. Is there any more information on how the 'zero_tokens' flag is supposed to behave for non-boolean types? -Bryan