From: Larry Evans (cppljevans_at_[hidden])
Date: 2008-03-10 14:16:45
On 03/10/08 12:08, Eric Niebler wrote:
> Markus Werle wrote:
>> Steven Watanabe <watanabesj <at> gmail.com> writes:
>>> The definition of expr is something like:
>>> template<class Tag, class Args, int Arity = Args::arity>
>>> struct expr;
>> OK, and what is the advantage of the 3rd template argument Arity then?
>> AFAICS this is needed for the BOOST_PP_ITERATION magic, but strictly speaking
>> it is not necessary for the data _representation_, right?
> You have to partially specialize on *something*. That's what the 3rd
> template parameter is for. This is not something I can remove. I can't
> get the design I need without it.
Couldn't you use a helper template, e.g. expr_arity,
*with* the third parameter = size<Args>::value and
then expr_arity is specialized on that last arg?
OOPS, then you'd be the same place you are now with an
the 2 arg expr and the 3 arg expr_arity specialized the
same number of times as the existing 3 arg expr. Since
there no gain is ability be extra templates, the better
solution is the existing 3 arg expr with specialization
on last arg. IOW, I kinda agree with Eric here.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk