Boost logo

Boost :

Subject: Re: [boost] [TTI] Review
From: Joel falcou (joel.falcou_at_[hidden])
Date: 2011-07-11 10:12:02

On 10/07/11 22:59, Edward Diener wrote:
> I will look into this. It is obviously more difficult programming with
> the latter than the former, but it is probably doable although with much
> effort. It may not be worth the effort.
> What the former syntax reflects is an exact transcription of the
> template parameters with each comma replaced by ')(' and a starting and
> ending parentheses. So for the template:
> 'template <class,class,int,class,template <class> class
> InnerTemplate,class,long> struct ManyParameters { }'
> the parameters are:
> '(class)(class)(int)(class)(template <class> class
> InnerTemplate)(class)(long)'
> and all I had to do as an end-user was copy the template parameters, add
> a '(' at the beginning, add a ')' at the end, and change every ',' to a
> ')('. As a programmer I take the sequence and directly convert it to the
> template parameters via a BOOST_PP_SEQ_ENUM.

Dunno if it helps but nt2 has a NT2_STRIP macro adapted from a amcro
pasoted by Steven Watanabe that conditionnally remove parens around
symbols. You can then pass parameters containing comma to the
preprocessor this way :

FOO( (template<class T, class U> struct foo) )

and this way if no comma is involved

FOO( struct bar )

THe cod eis available under Boost licensing and can be incorporated w/e
your need.

Boost list run by bdawes at, gregod at, cpdaniel at, john at