
28 Jun
2011
28 Jun
'11
12:44 a.m.
On 6/27/2011 8:31 PM, Jeffrey Lee Hellrung, Jr. wrote:
On Mon, Jun 27, 2011 at 4:21 PM, Edward Diener<eldiener@tropicsoft.com>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 !