Boost logo

Boost :

From: Aleksey Gurtovoy (agurtovoy_at_[hidden])
Date: 2002-04-12 04:06:53


Vesa Karvonen wrote:
> >MPL calls these BOOST_MPL_PP_PROJECT1ST and BOOST_MPL_PP_PROJECT2ND
> >(taking the STL terminology).
>
> The preprocessor library actually contains equivalent macros, but they are
> not documented and are currently considered a private implementation
detail.
> The BOOST_PP_TUPLE_ELEM() macro is implemented using macros that look like
> this:
>
> // ...
> #define BOOST_PP_TUPLE2_ELEM0(A,B) A
> #define BOOST_PP_TUPLE2_ELEM0(A,B) B
>
> #define BOOST_PP_TUPLE3_ELEM0(A,B,C) A
> #define BOOST_PP_TUPLE3_ELEM1(A,B,C) B
> #define BOOST_PP_TUPLE3_ELEM2(A,B,C) C
> // ...
>
> It seems unlikely that the implementation would change, because the
> alternative would be a slower implementation of BOOST_PP_TUPLE_ELEM(). So,
> perhaps these macros should be documented.

I would much prefer if the public macros had more generic names (preferably
STL-ish ones, something like I've cited above - BOOST_PP_PROJECT1ST,
BOOST_PP_PROJECT2ND :).

3 (and more)-argument forms don't seem necessary because the need for
PROJECT1ST/2ND arises only when you want to pass the macro to an iteration
primitive, and all of those (to my best knowledge) work only with binary
macros.

Aleksey


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