Boost C++ Libraries: Ticket #11893: boost program_options regression (--arg1 value) fails ( --arg1=value) ok https://svn.boost.org/trac10/ticket/11893 <p> The following test passes with boost 1.53 and fails with boost &gt; 1.59 </p> <blockquote> <p> { </p> <blockquote> <p> <em> This test fails on boost 1.59, can't cope --arg1 10, only --arg1=10 </em> <strong>* It does not honour the default style i.e unix </strong>* char* argv[] = { </p> <blockquote> <p> const_cast&lt;char*&gt;("test_program_options_implicit_value"), const_cast&lt;char*&gt;("--arg1"), const_cast&lt;char*&gt;("10") </p> </blockquote> <p> }; </p> </blockquote> </blockquote> <blockquote> <blockquote> <p> po::variables_map vm; po::store(po::parse_command_line(3, argv, desc), vm); po::notify(vm); </p> </blockquote> </blockquote> <blockquote> <blockquote> <p> BOOST_CHECK_MESSAGE(vm.count("arg1"), "Expected arg1"); BOOST_CHECK_MESSAGE(vm<a class="missing wiki">arg1</a>.as&lt;string&gt;() == "10", "Expected arg1 with value of 10 but found '" &lt;&lt; vm<a class="missing wiki">arg1</a>.as&lt;string&gt;() &lt;&lt; "'"); </p> </blockquote> <p> } </p> </blockquote> <p> In addition the default style is unix_style, which according to the header file should be able to cope with both styles. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/11893 Trac 1.4.3 avibahra@… Thu, 07 Jan 2016 11:12:27 GMT <link>https://svn.boost.org/trac10/ticket/11893#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11893#comment:1</guid> <description> <p> The correct program should be: </p> <pre class="wiki"> po::options_description desc("Allowed options"); desc.add_options() ("help", "produce help message") ("arg1", po::value&lt;string&gt;()-&gt;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&lt;char*&gt;("test_program_options_implicit_value"), const_cast&lt;char*&gt;("--arg1"), const_cast&lt;char*&gt;("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&lt;string&gt;() == "10", "Expected arg1 with value of 10 but found '" &lt;&lt; vm["arg1"].as&lt;string&gt;() &lt;&lt; "'"); } </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>Vladimir Prus</dc:creator> <pubDate>Sat, 10 Jun 2017 20:04:08 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/11893#comment:2 https://svn.boost.org/trac10/ticket/11893#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> Ticket Vladimir Prus Sat, 10 Jun 2017 20:04:25 GMT <link>https://svn.boost.org/trac10/ticket/11893#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11893#comment:3</guid> <description> <p> Fixed as of revision b35e654. </p> </description> <category>Ticket</category> </item> </channel> </rss>