BOOST_PP_REPEAT to repeat comma-containing text
Hello, I'm trying to repeat a group of actual parameters (passed to some 3d party plain-C "variadic" function). The function call looks like this: func(count, param1, param2, arr1[0], arr2[0], param1, param2, arr1[1], arr2[1], param1, param2, arr1[2], arr2[2] /* etc */); So essentially, I'd like to repeat (param1, param2, arr1[n], arr2[n]) group. What is the right way to invoke BOOST_PP_REPEAT in this case? Thanks.
Igor R писал 2014-04-08 16:25:
Hello,
I'm trying to repeat a group of actual parameters (passed to some 3d party plain-C "variadic" function). The function call looks like this:
func(count, param1, param2, arr1[0], arr2[0], param1, param2, arr1[1], arr2[1], param1, param2, arr1[2], arr2[2] /* etc */);
So essentially, I'd like to repeat (param1, param2, arr1[n], arr2[n]) group. What is the right way to invoke BOOST_PP_REPEAT in this case?
Hi,
example:
#include
I'm trying to repeat a group of actual parameters (passed to some 3d party plain-C "variadic" function). The function call looks like this:
func(count, param1, param2, arr1[0], arr2[0], param1, param2, arr1[1], arr2[1], param1, param2, arr1[2], arr2[2] /* etc */);
So essentially, I'd like to repeat (param1, param2, arr1[n], arr2[n]) group. What is the right way to invoke BOOST_PP_REPEAT in this case?
Just realized that commas do not affect anything here, so the straghtforward BOOST_PP_REPEAT invocation does the job: #define EXPR(z, x, text) BOOST_PP_COMMA_IF(x) param1, param2, arr1[x], arr2[x] #define REPEAT_PARAMS(x) BOOST_PP_REPEAT(x, EXPR, _) func(count, REPEAT_PARAMS(5)); Sorry for the noise.
participants (2)
-
Igor R
-
niXman