Boost C++ Libraries: Ticket #5464: Problem with implicit value in program options https://svn.boost.org/trac10/ticket/5464 <p> I have created a test program (test_progopts.cpp, please see attachment) to familiarize myself with the program options library. I have compiled and run the test on Windows. </p> <p> In my test program I have two visible options "help,?" and "bool-opt,a" and one hidden options "input-file". If I run the test program using the following commands, I get my expected result: </p> <blockquote> <p> test_progopts -? test_progopts --help test_progopts -a test_progopts --bool-opt test_progopts test1.cpp </p> </blockquote> <p> However, if I run the test program using these commandc, it fails: </p> <blockquote> <p> test_progopts -a test1.cpp test_progopts --bool-opt test1.cpp </p> </blockquote> <p> I get the error message: </p> <blockquote> <p> in option 'bool-opt': invalid bool value </p> </blockquote> <p> From this error message, it appears that the implicit value is not working. Is my observation valid? </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/5464 Trac 1.4.3 lcarreon@… Tue, 12 Apr 2011 23:38:25 GMT attachment set https://svn.boost.org/trac10/ticket/5464 https://svn.boost.org/trac10/ticket/5464 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">test_progopts.cpp</span> </li> </ul> <p> Program options library test program </p> Ticket Leo Carreon <lcarreon@…> Tue, 17 May 2011 22:42:31 GMT <link>https://svn.boost.org/trac10/ticket/5464#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5464#comment:1</guid> <description> <p> Hi, </p> <p> Can I please have some feedback on this. </p> <p> Regards, </p> <p> Leo </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Vladimir Prus</dc:creator> <pubDate>Wed, 18 May 2011 05:39:58 GMT</pubDate> <title>type changed https://svn.boost.org/trac10/ticket/5464#comment:2 https://svn.boost.org/trac10/ticket/5464#comment:2 <ul> <li><strong>type</strong> <span class="trac-field-old">Bugs</span> → <span class="trac-field-new">Support Requests</span> </li> </ul> <p> I think the library is behaving at it should. Implicit makes the option accept zero tokens. However, the option will still accept a token if one is provided. Your command line has: </p> <blockquote> <p> --bool-opt test1.cpp </p> </blockquote> <p> and test1.cpp is treated as value for --bool-opt. You can use bool_switch function to create optin that never accepts parameters. </p> <p> Does this answer your question? </p> Ticket Leo Carreon <lcarreon@…> Wed, 18 May 2011 07:14:42 GMT <link>https://svn.boost.org/trac10/ticket/5464#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5464#comment:3</guid> <description> <p> Hi, </p> <p> Thanks for the reply. It does answer my question. </p> <p> You may close this ticket. </p> <p> Regards, </p> <p> Leo </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Vladimir Prus</dc:creator> <pubDate>Wed, 18 May 2011 07:27:00 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/5464#comment:4 https://svn.boost.org/trac10/ticket/5464#comment:4 <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