
Matthew Herrmann 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
Thorsten Ottosen wrote: 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 it. - Volodya