Boost C++ Libraries: Ticket #564: program_options: additional parser bug https://svn.boost.org/trac10/ticket/564 <pre class="wiki">alexander.kondratyuk@gmail.com It seems there is a bug in additional parser wrapper - in case then my option has no parameters defined and declared in description, it adds an empty value to the vector of values when additional paser returns pair of strings. Changing code in cmdline.cpp in function cmdline::handle_additional_parser from next.value.push_back(r.second); to if (!r.second.empty()) next.value.push_back(r.second); will fix the problem. Here is an example that illustrates the problem: #define BOOST_WHATEVER_DYN_LINK #define BOOST_LIB_DIAGNOSTIC #include &lt;boost/program_options/variables_map.hpp&gt; #include &lt;boost/program_options/options_description.hpp&gt; #include &lt;boost/program_options/parsers.hpp&gt; #include &lt;boost/program_options/detail/utf8_codecvt_facet.hpp&gt; #include &lt;boost/token_iterator.hpp&gt; #include &lt;boost/shared_ptr.hpp&gt; using namespace boost::program_options; #include &lt;string&gt; #include &lt;vector&gt; using namespace std; pair&lt;string, string&gt; parserDashDashShort(const string&amp; s) { string str = s.substr( 0, s.find('=') ); if( str.length()==3 &amp;&amp; str[0]=='-' &amp;&amp; str[1]=='-' &amp;&amp; str[2]&lt;='z' &amp;&amp; str[2]&gt;='a') { string val = s.substr(str.length()); return make_pair( str.substr(1), val ); } return make_pair(string(), string()); } int _tmain(int , _TCHAR* argv[]) { int style = command_line_style::allow_short| command_line_style::allow_dash_for_short | command_line_style::short_allow_adjacent; options_description desc; desc.add_options() ("help,h", "help message") ; char* args[]={"program.exe", "--h"}; int argc = sizeof( args ) / sizeof( args[0] ); parse_command_line&lt;char&gt;( argc, (char**)args, desc, style, parserDashDashShort ); return 0; } </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/564 Trac 1.4.3 Vladimir Prus Wed, 10 May 2006 06:33:16 GMT status changed https://svn.boost.org/trac10/ticket/564#comment:1 https://svn.boost.org/trac10/ticket/564#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> </ul> <pre class="wiki">Logged In: YES user_id=321498 This bug was fixed in CVS. </pre> Ticket