###  | # Boost.Preprocessor ## Reference

Prev Next Macros Headers

# #include <boost/preprocessor/list/for_each_i.hpp>

## #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);

### Uses

- BOOST_PP_FOR() (see for explanation of the R parameter)

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

Can be used inside BOOST_PP_FOR().

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.