Boost logo

Boost :

Subject: Re: [boost] [preprocessor] ARRAY_REPLACE bug?
From: Edward Diener (eldiener_at_[hidden])
Date: 2013-07-25 07:51:03


On 7/25/2013 5:10 AM, Mostafa wrote:
> On Windows 7/Cygwin, using boost 1.53, preprocessing the following snippet:
>
> pp_array.cc
> -----------
> #include <boost/preprocessor.hpp>
>
> //#define BOOST_PP_TUPLE_REM_0() // nothing
>
> #define ARRAY (3, (a, x, c))
> BOOST_PP_ARRAY_REPLACE(ARRAY, 1, b)
>
> via:
> g++ -E -P -I /... pp_array.cc
>
> gives the following incorrect result:
> (3, (BOOST_PP_TUPLE_REM_0 () a, b , c))
>
> Uncommenting the pound define in the snippet gives the correct result for
> the preprocessor.
>
> Is this a bug?

It looks like a bug to me. In your 1.53 version of tuple/rem.hpp add:

# define BOOST_PP_TUPLE_REM_0()

before the line which says:

# define BOOST_PP_TUPLE_REM_1(e0) e0

For some reason, possibly an oversight, Paul removed the "# define
BOOST_PP_TUPLE_REM_0()" from tuple/rem.hpp when variadic macro support
was added to the preprocessor.


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