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.
Well I hope this can work for you:
// This wont output a template for nullary function
#define TEMPLATE_IF(n) BOOST_PP_IF(n, BOOST_PP_TUPLE_REM(1), BOOST_PP_TUPLE_EAT(1))
#define EACH(z, n, data) \
TEMPLATE_IF(n)(template