###  | # Boost.Preprocessor ## Header <boost/preprocessor/list/for_each_i.hpp>

Prev Next Macros Headers

### #define BOOST_PP_LIST_FOR_EACH_I(MACRO,DATA,LIST)

Repeats `MACRO(R,DATA,INDEX,BOOST_PP_LIST_AT(LIST,INDEX))` for each INDEX = [0, BOOST_PP_LIST_SIZE(LIST)).

In other words, expands to the sequence:

    MACRO(R,DATA,0,BOOST_PP_LIST_AT(LIST,0))
    MACRO(R,DATA,1,BOOST_PP_LIST_AT(LIST,1))
    ...
    MACRO(R,DATA,BOOST_PP_DEC(BOOST_PP_LIST_SIZE(LIST)),BOOST_PP_LIST_AT(LIST,BOOST_PP_DEC(BOOST_PP_LIST_SIZE(LIST))))

For example,

    #define TEST(R,DATA,INDEX,X) BOOST_PP_CAT(DATA,X)(INDEX);
    BOOST_PP_LIST_FOR_EACH_I(TEST,prefix_,BOOST_PP_TUPLE_TO_LIST(3,(A,B,C)))

expands to:

    prefix_A(0); prefix_B(1); prefix_C(2);

### #define BOOST_PP_LIST_FOR_EACH_I_R(R,MACRO,DATA,LIST)

Can be used inside BOOST_PP_FOR() (see for an explanation of the R parameter).

Prev Next Macros Headers

Revised

© Copyright Housemarque Oy 2002

Permission to copy, use, modify, sell and distribute this document is granted provided this copyright notice appears in all copies. This document is provided "as is" without express or implied warranty, and with no claim as to its suitability for any purpose.