Boost logo

Boost Users :

From: Maximilian Matthe (Maxi.Matthe_at_[hidden])
Date: 2008-07-16 07:26:49


Peter Bartlett schrieb:
> Quoting Maximilian Matthe <Maxi.Matthe_at_[hidden]>:
>
>> 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)()

Ah thank you. This is quite tricky :-)


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net