Boost logo

Boost :

Subject: Re: [boost] painless currying
From: Paul Mensonides (pmenso57_at_[hidden])
Date: 2011-08-31 22:54:44


On Wed, 31 Aug 2011 16:09:30 -0400, Edward Diener wrote:

> If I can correct the curryable.h code I believe the use of
>
> #elif BOOST_PP_ITERATION_FLAGS() == 1
>
> and
>
> #elif BOOST_PP_ITERATION_FLAGS() == 2
>
> is wrong because BOOST_PP_ITERATION_FLAGS() is always evaluated in these
> lines even when BOOST_PP_IS_ITERATING is not defined. I think instead
> you must specify:

It isn't "evaluated" so much as macro-expanded and parsed.
 
> #else
> #if BOOST_PP_ITERATION_FLAGS() == 1
> ....
> #else
> #if BOOST_PP_ITERATION_FLAGS() == 2
> ....
> #endif
> #endif

It should be sufficient to do this:

#if !BOOST_PP_IS_ITERATING

#else
    #if BOOST_PP_ITERATION_FLAGS() == 1
        ...
    #elif BOOST_PP_ITERATION_FLAGS() == 2
        ...
    #endif
#endif

-Paul


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