Re: [Boost-bugs] [Boost C++ Libraries] #4857: Boost.Parameter Constructor in Templates Not Supported?

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #4857: Boost.Parameter Constructor in Templates Not Supported?
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-11-16 09:46:38


#4857: Boost.Parameter Constructor in Templates Not Supported?
--------------------------------------+-------------------------------------
  Reporter: mikhailberis | Owner: danielw
      Type: Bugs | Status: new
 Milestone: To Be Determined | Component: parameter
   Version: Boost Development Trunk | Severity: Problem
Resolution: | Keywords:
--------------------------------------+-------------------------------------

Comment (by danielw):

 There are two problems here:

 1. Type requirements should be parenthesized:
 {{{
   (arg1, (int))
 }}}

 2. BOOST_PARAMETER_CONSTRUCTOR() is far less convenient than
 BOOST_PARAMETER_FUNCTION() in that it does not take default values for
 optional parameters, but rather expects the base constructor to do the
 right thing. This is shown in the docs at:

   http://www.boost.org/doc/libs/1_44_0/libs/parameter/doc/html/index.html
 #parameter-enabled-constructors

   but is missing from the reference documentation.

 Changing your example accordingly:

 {{{
          struct base {
              template <class ArgPack>
              base(ArgPack const & args)
 - : val1(args[_arg1])
 - , val2(args[_arg2])
 + : val1(args[_arg1 | 0])
 + , val2(args[_arg2 | 0])
              {}

              int val1,val2;
 @@ -24,7 +24,7 @@
          struct derived : base<Tag> {
              BOOST_PARAMETER_CONSTRUCTOR(
                  derived, (base<Tag>), tag,
 - (optional (arg1,int,1) (arg2,int,2)))
 + (optional (arg1,(int)) (arg2,(int))))
          };
 }}}

 makes it compile.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/4857#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:04 UTC