Subject: Re: [Boost-bugs] [Boost C++ Libraries] #11893: boost program_options regression (--arg1 value) fails ( --arg1=value) ok
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-01-07 11:12:27
#11893: boost program_options regression (--arg1 value) fails ( --arg1=value) ok
-------------------------------+-----------------------------
Reporter: avibahra@⦠| Owner: vladimir_prus
Type: Bugs | Status: new
Milestone: To Be Determined | Component: program_options
Version: Boost 1.61.0 | Severity: Regression
Resolution: | Keywords: unix_style
-------------------------------+-----------------------------
Comment (by avibahra@â¦):
The correct program should be:
{{{
po::options_description desc("Allowed options");
desc.add_options()
("help", "produce help message")
("arg1", po::value<string>()->implicit_value( string("") ),
"optional arg1 description") ;
{
// ******* This test fails on boost 1.59, can't cope --arg1 10, only
--arg1=10 *******
char* argv[] = {
const_cast<char*>("test_program_options_implicit_value"),
const_cast<char*>("--arg1"),
const_cast<char*>("10")
};
po::variables_map vm;
po::store(po::parse_command_line(3, argv, desc), vm); // populate
variable map
po::notify(vm);
BOOST_CHECK_MESSAGE(vm.count("arg1"), "Expected arg1");
BOOST_CHECK_MESSAGE(vm["arg1"].as<string>() == "10", "Expected arg1
with value of 10 but found '" << vm["arg1"].as<string>() << "'");
}
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/11893#comment:1> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:19 UTC