Boost logo

Boost :

From: John Eddy (johneddy_at_[hidden])
Date: 2005-02-02 15:34:45


I am not terribly familiar with the rules of the preprocessor. Is it
the case that the expression of the BOOST_PP_EXPR_IF macro is expanded
regardless of the resulting value of the condition?

The reason I ask is because the following code produces a warning with
VC7 .NET 2003.

#define
MY_MACRO(array) \
    
BOOST_PP_EXPR_IF( \
        
BOOST_PP_ARRAY_SIZE(array), \
        
BOOST_PP_TUPLE_TO_SEQ( \
            
BOOST_PP_ARRAY_SIZE(array), \
            
BOOST_PP_ARRAY_DATA(array) \
        
) \
    )

MY_MACRO((0, ()));

The warning is:

C4003: not enough actual parameters for macro 'BOOST_PP_EXPR_IIF_0'

The macro expands correctly.

Perhaps there is a better way to do what I am after. I would like to
create a comma separated list (no parenthesis as would be the case if I
only took the array data) from a possibly empty set.

Thanks,
John


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