Boost logo

Boost :

Subject: Re: [boost] [program_options]
From: Richard Hazlewood (boost_at_[hidden])
Date: 2010-03-05 04:02:18


Matthew Herrmann <matthew.herrmann <at> zomojo.com> writes:

>
> Thorsten Ottosen wrote:
> > I tried using
> >
> > bpo::options_description desc("Allowed options");
> > desc.add_options()
> > (HELP, "produce help message");
> >
> > but this fails to compile because HELP is an std::string.
>
> I'd vote to replace const char* everywhere in the program options
> interface with std::string. (excluding the "char* argv[]" of course)

This would certainly help for cases where I construct the description string
from other program details, i.e. it would avoid having to extract the "c_str
()", e.g.

  std::string otherProgramDetail;

  add_opt...
    ("option", ("blah blah " + otherProgramDetail + " more blah").c_str() )

Also:
- The name/description are held as strings internally, anyway.
- The "default_value()"'s second argument, for specifying the default value as
a textual representation, _is_ an std::string. So it would improve
consistency.

So, +1.

Regards,
Chard.


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