I'm trying to provide std::string argument as a description of option. In general, an argument whose scope of life is not defined. In details, I want to provide translation.
using namespace boost::program_options;
using namespace boost::locale;
options_description desc (translate ("Hello world!"));
desc.add_options ()
("help", translate ("Veni vidi vici"))
;
add_options() returns an instance of options_description_easy_init which pre-defines the () operator so that you can use the syntax above. Now, that operator accepts only const char* as description and this bugs me out. Hence I have the following questions in mind:
- What could be the way to approach this problem?
What is the ownership policy of this class? Are these pointers only stored, hence the source, should live as much as the description lives or it is safe to (yuck!):
("help", translate ("Veni vidi vici").str ().c_str ())What is the rationale of having only
const char_type*as description parameter?