Boost logo

Boost :

Subject: Re: [boost] [program_options]
From: Matthew Herrmann (matthew.herrmann_at_[hidden])
Date: 2010-03-04 18:27:44

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.
> Isn't that a bit too restrictive?
Last I checked, boost::program_options took const char* in several
places where it would end up storing them as std::strings anyway. Taking
"const std::string&" would also clarify that passing temporary strings
is fine, whereas "const char*" as an arg hints to me that the pointers
should remain valid until options_description is destroyed (purely
question of taste though).

I'd vote to replace const char* everywhere in the program options
interface with std::string. (excluding the "char* argv[]" of course)

My 5c,

Boost list run by bdawes at, gregod at, cpdaniel at, john at