
Vladimir Prus píše v Čt 24. 09. 2015 v 12:13 +0300:
Hi Marek,
On 23-Sep-15 4:41 PM, Marek Skalický wrote:
Hello everyone, I have a question about program_option library.
If I have argv=["binaryname", "--port", "5"] and port have set default_value=6 and implicit_value=7 what should be the value of port after parsing argv?
It should be 5.
default_value does not matter because the --port option is provided implicit_value does not matter because the --port option includes a value explicitly
Thanks.
I am asking because this test https://github.com/mongodb/mongo/blob/0481c958daeb2969800511e7475dc66986fa9e... is failing with boost 1.59 (with boost 1.58 it is passing). Does someone please know what changed in this new version?
Does this issue reproduces when using program_options directly? The code above appears to use classes that are similar, but not the same.
I separated boost code. However, this code still fails: " namespace po = boost::program_options; po::options_description boostOptions; po::positional_options_description boostPositionalOptions; std::vector<const char*> argv_buffer; argv_buffer.push_back("binaryname"); argv_buffer.push_back("--port"); argv_buffer.push_back("5"); int argc = argv_buffer.size(); int style = (((po::command_line_style::unix_style ^ po::command_line_style::allow_guessing) | po::command_line_style::allow_long_disguise) ^ po::command_line_style::allow_sticky); std::auto_ptr<po::typed_value<std::string> > boostTypeBuilder(po::value<std::string>()); boostTypeBuilder->implicit_value("7"); std::auto_ptr<po::value_semantic> boostType; boostType = boostTypeBuilder; boostOptions.add_options()("port", boostType.release(), "Port"); po::command_line_parser(argc, (argc > 0 ? &argv_buffer[0] : NULL)). options(boostOptions). positional(boostPositionalOptions). style(style);. run(); " What is wrong? Or is this a bug in Boost? Thanks, Marek