
3 Oct
2007
3 Oct
'07
12:29 a.m.
Michael Fawcett wrote:
On 10/2/07, Josh Brown
wrote: The root of my problem seems to stem from the fact that BOOST_PP_IF expands both the true and false expressions before it does the if test and just outputs the already expanded expression. Is this correct; and if so, is there a way around it?
Make the IF lazy.
Or are there any obvious other solutions to my problem that the boost experts can suggest :)
You'll want to look into BOOST_PP_TUPLE_EAT - http://www.boost.org/libs/preprocessor/doc/ref/tuple_eat.html
Exactly. #define GET_OPTIONAL_ELEMENT(r, data, elem) \ BOOST_PP_IF( \ BOOST_PP_EQUAL(BOOST_PP_SEQ_SIZE(elem), 3), \ BOOST_PP_SEQ_ELEM, BOOST_PP_TUPLE_EAT(2) \ )(2,elem) Regards, Tobias