Boost logo

Boost Users :

From: Bryan Green (bgreen_at_[hidden])
Date: 2007-06-12 14:33:22


Hello,

Is there a mechanism in boost::program_options for supporting optional
arguments? If not, is there a suggested program_options-based alternative?

This question was posed by someone else about a year ago, but did not get a
response. Here is the quote:

BEGIN QUOTE

From: Dale McCoy (dalestan_at_[hidden])
Date: 2006-04-22 21:15:51

I'm trying to convert from getopt (GNU's getopt_long, to be more
specific) to boost::program_options, but have run into trouble
converting "D::" and {"data",optional_argument,NULL,'D'} (If you're
not familiar with getopt, that means that --data is equivalent to -D,
and both take an optional argument, so "-D", "--data", "-Darg", and
"--data=arg" are all valid.) I see that the first argument to
add_option should be "data,D", but then things get fuzzy.

I saw nothing in the documentation concerning optional arguments,
either directly, or using additional parsers. What is the appropriate
method for implementing such options?

I'm using currently using Boost 1.33.1.

Dale

END QUOTE

Bryan


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net