Boost logo

Boost :

Subject: Re: [boost] Re : Re : [preprocessor] ifdef equivalent inside a macro, is it possible?
From: Maxime van Noppen (maxime_at_[hidden])
Date: 2011-08-10 13:20:20


On 08/10/2011 06:57 PM, damien benoist wrote:
> Then there would be no more need for the if.
> But I would like to not even have one line to write for each macro.
>
> Thanks for your answer.

Is it possible for you to make the macro defined to some special value
rather than being undefined ?

Something like :

#include <boost/preprocessor/control/if.hpp>
#include <boost/preprocessor/facilities/empty.hpp>
#include <boost/preprocessor/list/adt.hpp>

#ifdef DEFINE_FOO
# define FOO (foo, BOOST_PP_NIL)
#else
// Rather than being undefined, make it an empty list
# define FOO (BOOST_PP_NIL)
#endif

# define BAR BOOST_PP_IF(BOOST_PP_LIST_IS_NIL(FOO), \
                        bar,\
                        BOOST_PP_LIST_FIRST(FOO))

-- 
Maxime

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