16 Jul
2008
16 Jul
'08
11:16 a.m.
Quoting Maximilian Matthe
Hello!
#define seq (int)(int)
BOOST_PP_IF(1, BOOST_PP_SEQ_ENUM(seq), BOOST_PP_EMTPY)
does not expand to what i want: it should be int, int . G++ gives the following error:
test.cpp:20:1: macro "BOOST_PP_IIF" passed 4 arguments, but takes just 3 BOOST_PP_IIF
which is logical, because SEQ_ENUM expands to int, int and so if gets 4 arguments. I tried to surround SEQ_ENUM with IDENTITY but it's the same problem. Only surrounding SEQ_ENUM with () works, but then I have the () in the code, which I do not want. How can I solve this problem?
Max
You need to delay the evaluation of the SEQ_ENUM til after the IF: #define DO_NOTHING(seq) BOOST_PP_IF(1, BOOST_PP_SEQ_ENUM , DO_NOTHING)()