Boost C++ Libraries: Ticket #8603: BOOST_PARAMETER_CONSTRUCTOR with no required arugments https://svn.boost.org/trac10/ticket/8603 <p> The following variation on the example from the boost::parameter tutorial, where the required parameter is changed to optional, fails to compile. myclass_impl is passed an empty agrument list. </p> <pre class="wiki">#include &lt;iostream&gt; #include &lt;boost/parameter.hpp&gt; BOOST_PARAMETER_NAME(name) BOOST_PARAMETER_NAME(index) struct myclass_impl { template &lt;class ArgumentPack&gt; myclass_impl(ArgumentPack const&amp; args) { std::cout &lt;&lt; "name = " &lt;&lt; args[_name] &lt;&lt; "; index = " &lt;&lt; args[_index] &lt;&lt; std::endl; } }; struct myclass : myclass_impl { BOOST_PARAMETER_CONSTRUCTOR( myclass, (myclass_impl), tag , (optional (name, *) (index, *) ) ) // no semicolon }; int main(int argc, char * argv[]) { myclass C(_name="hello", _index=0); } </pre><p> Compilation output: </p> <pre class="wiki">In instantiation of 'myclass_impl::myclass_impl(const ArgumentPack&amp;) [with ArgumentPack = boost::parameter::aux::empty_arg_list]': ... </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/8603 Trac 1.4.3 james.hirschorn@… Tue, 21 May 2013 18:08:48 GMT attachment set https://svn.boost.org/trac10/ticket/8603 https://svn.boost.org/trac10/ticket/8603 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">main.cpp</span> </li> </ul> <p> example reproducing bug </p> Ticket James.Hirschorn@… Tue, 21 May 2013 21:34:09 GMT <link>https://svn.boost.org/trac10/ticket/8603#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8603#comment:1</guid> <description> <p> This bug should be closed. It was pointed out on the devel mailing list that optional arguments to BOOST_PARAMETER_CONSTRUCTOR must be extraced with a '|' default specifier (e.g. arg[_name | ""]). </p> <p> However, this should still be explicitly stated in the documentation. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Sun, 09 Jun 2013 19:29:12 GMT</pubDate> <title>status changed; resolution set; milestone deleted https://svn.boost.org/trac10/ticket/8603#comment:2 https://svn.boost.org/trac10/ticket/8603#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">invalid</span> </li> <li><strong>milestone</strong> <span class="trac-field-deleted">To Be Determined</span> </li> </ul> Ticket