Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2004-05-07 10:06:29


Rob Stewart wrote:
> Vladimir Prus wrote:
> > 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.
>
> The default value could simply be given as a string in that case:
> "(1,1)" or whatever. You could also use the OutputFormatters
> library when it is accepted into Boost. (In that case, you just
> wait for your automated solution.)

In the highly likely case when the default value of vector is empty vector,
output formatters will provide not very nice result.

I still think that ultimately we'd need 'vector_value', since

        ("second", vector_value<int>())

is a lot better than

        ("second", value< vector<int > >()->default_value(vector<int>(), ""))

- Volodya


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