27 Oct
2012
27 Oct
'12
10:48 a.m.
2012/10/26 Daniel James
On 26 October 2012 19:41, weiqingh
wrote: hi there,
I would like to use boost preprocessor to generate something like this: (for n from 0 to N with n = 2 in the following example)
template
void foo(T1 t1, T2 t2) I have tried to use BOOST_PP_ENUM_PARAMS but cannot figure out how to get both T_i and t_i changed each time. is there some other macros I can use? any help is highly appreciated.
You want BOOST_PP_ENUM_BINARY_PARAMS.
Here's my shot at the this, *not* tested: #define FOO( n ) \ BOOST_PP_EXPR_IF( N, template < ) \ BOOST_PP_ENUM_PARAMS( n, typename T ) \ BOOST_PP_EXPR_IF( N, template < ) \ void foo( BOOST_PP_ENUM_BINARY_PARAMS( n, T, t) ) HTH, Kris