Boost logo

Boost :

Subject: Re: [boost] [preprocessor] Warning: Incoming
From: Edward Diener (eldiener_at_[hidden])
Date: 2011-06-27 20:44:09


On 6/27/2011 8:31 PM, Jeffrey Lee Hellrung, Jr. wrote:
> On Mon, Jun 27, 2011 at 4:21 PM, Edward Diener<eldiener_at_[hidden]>wrote:
> [...]
>
>> This has led me to work on some macros for pp-lib, which uses variadics,
>> which can tell whether a macro parameter is a tuple, array, seq, or list.
>>
>> Then in your case you can go:
>>
>> #define STRIP_PARENS(x)\
>> BOOST_PP_IIF(BOOSTPP_IS_TUPLE(x),BOOST_PP_TUPLE_ENUM(x),x)
>>
>
> I'm not a preprocessing expert, so I would be afraid of the preprocessor
> trying to expand BOOST_PP_TUPLE_ENUM(x) when x is not a tuple. If so, I
> would think something like
>
> #define STRIP_PARENS( x ) BOOST_PP_IIF( BOOST_PP_IS_TUPLE( x ),
> BOOST_PP_TUPLE_ENUM, BOOST_PP_IDENTITY ) ( x )
>
> would be better...?

You are right. Good catch !


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk