Boost logo

Boost :

From: Neal D. Becker (ndbecker2_at_[hidden])
Date: 2004-05-07 06:26:27


Vladimir Prus wrote:

> Neal D. Becker wrote:
>
>> > Require that all default_value()'s provide a default value string
>> > either from operator << or explicitly when supplying the default value?
>> >
>> > default_value(x) -> must support operator <<(x)
>> > default_value(x, "x") -> no need for operator <<(x)
>>
>> Good idea!
>
> True. I've just comitted/uploaded revision 288 which produces the
> following (don't forget to use fixed font when viewving ;-) )
>
> Usage: options_description [options]
> Allowed options:
> --help : produce help message
> --optimization arg (=10) : optimization level
> -I [ --include-path ] arg : include path
> --input-file arg : input file
>
> The (=10) is meant to give default value. The only problem I've found is
> that we need to specify empty default value string for std::vector, which
> leads to code like this:
>
> ("second", value< vector<int > >()->default_value(vector<int>(1, 1),
> ""))
>
> Ok, maybe we just need 'vector_value' function which will take care of
> default values.
>

You also have the choice of not using default_value.

main() {
  value (1,1); //set default outside of program_options

  program_options....

So I don't think the case you show above is a serious problem. (Nobody
forces you to use default_value if it's not convenient).


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk