
On 7/11/2011 10:12 AM, Joel falcou wrote:
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.
I already know about this ( Mathias Gaunard reminded me ), and have added it to a possible future implementation for pp-lib. The implementation needs variadic macro support.
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 )
As long as one has variadic macro support in the compiler this can be handled, in which case: FOO( template<class T, class U> struct foo ) is also possible. The issue I brought up in my answer to Lorenzo's review remains the same: do I drop support for a macro metafunction in TTI if the compiler does not have variadic macro support ?