Subject: [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:13:03
#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
Keywords: |
-------------------------------------+--------------------------------------
If I try to create a Boost.Parameter Constructor as shown in the following
code listing, I get a handful of errors in the preprocessor code used by
`BOOST_PARAMETER_CONSTRUCTOR`:
{{{
#include <boost/parameter.hpp>
namespace foo {
BOOST_PARAMETER_NAME(arg1)
BOOST_PARAMETER_NAME(arg2)
template <class Tag>
struct base {
template <class ArgPack>
base(ArgPack const & args)
: val1(args[_arg1])
, val2(args[_arg2])
{}
int val1,val2;
};
template <class Tag>
struct derived : base<Tag> {
BOOST_PARAMETER_CONSTRUCTOR(
derived, (base<Tag>), tag,
(optional (arg1,int,1) (arg2,int,2)))
};
} /* foo */
struct default_ {};
int main(int argc, char * arg[]) {
foo::derived<default_> instance();
return 0;
}
}}}
With GCC 4.4 on Ubuntu Linux I get the following errors:
{{{
dean_at_dean-desktop:~/Source/spike$ g++ -o boost_parameter_template
boost_parameter_template.cpp -I~/boost/
boost_parameter_template.cpp:24: error: macro
"BOOST_PARAMETER_FOR_EACH_pred_aux2" passed 3 arguments, but takes just 2
boost_parameter_template.cpp:24: error: macro "BOOST_PP_SPLIT_0" requires
2 arguments, but only 1 given
boost_parameter_template.cpp:24: error: macro "BOOST_PP_SEQ_ELEM_III"
requires 2 arguments, but only 1 given
boost_parameter_template.cpp:24: error: macro "BOOST_PP_SEQ_ELEM_III"
requires 2 arguments, but only 1 given
boost_parameter_template.cpp:24: error: âBOOST_PP_IIF_0â was not declared
in this scope
boost_parameter_template.cpp:24: error: template argument 1 is invalid
boost_parameter_template.cpp:24: error:
âBOOST_PP_REPEAT_1_BOOST_PP_TUPLE_ELEM_2_0â does not name a type
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/4857> 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