Boost logo

Boost :

Subject: Re: [boost] [program_options]
From: Vladimir Prus (vladimir_at_[hidden])
Date: 2010-03-05 01:21:21

Matthew Herrmann wrote:

> 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)

'replace'? I'm afraid, over my dead body only. I surely don't want
implicit conversion to happen, and bloat the code, for every name and
description of the option.

I don't recall why string overloads are not provided, I'll have to think about

- Volodya

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