[parameter] Can't piecewise compose arguments.

I'm using the Parameters lib in class constructors. In which case I end up having to piecewise build argument lists as classes call the superclass ctors. But as it turns out it doesn't compile, for example: #include <boost/parameter.hpp> namespace Param { BOOST_PARAMETER_KEYWORD(Tag,a0) BOOST_PARAMETER_KEYWORD(Tag,a1) BOOST_PARAMETER_KEYWORD(Tag,a2) } struct A { template <typename ArgPack> A(ArgPack const & args) { int i = args[Param::a0]; int j = args[Param::a1]; } }; struct B : A { template <typename ArgPack> B(ArgPack const & args) : A((args, Param::a0 = 1)) { } }; void param_test() { A a((Param::a0 = 1, Param::a1 = 13, Param::a2 = 6)); B b0((Param::a1 = 13)); B b1((Param::a1 = 13, Param::a2 = 6)); //!! } The "b1" declaration doesn't compile, although it seems like it should. The reason is simple enough, the operator,() in arg_list isn't const which causes a no function match error. The fix is obvious: ===boost/parameter/aux_/arg_lit.hpp=== @@ -311,5 +311,5 @@ template <class KW, class T2> arg_list<tagged_argument<KW, T2>, self> < operator,(tagged_argument<KW,T2> x) -> operator,(tagged_argument<KW,T2> x) const { return arg_list<tagged_argument<KW,T2>, self>(x, *this); ====== Sorry if I don't have reasonable diff, this is from Perforce :-( Is there a rational for the operator,() not being const? -- -- Grafik - Don't Assume Anything -- Redshift Software, Inc. - http://redshift-software.com -- rrivera/acm.org - grafik/redshift-software.com -- 102708583/icq - grafikrobot/aim - grafikrobot/yahoo

Rene Rivera <grafik.list@redshift-software.com> writes:
Is there a rational for the operator,() not being const?
I don't think so. Please feel free to make the patch, but please fix any ensuing test failures! :) -- Dave Abrahams Boost Consulting www.boost-consulting.com
participants (2)
-
David Abrahams
-
Rene Rivera