The BOOST_PP_SET_FOR_EACH_I macro repeats a macro for each element in a set.

Usage

BOOST_PP_SET_FOR_EACH_I(macro, data, set)

Arguments

macro
A macro of the form macro(r, data, i, elem).  This macro is expanded by BOOST_PP_SET_FOR_EACH_I with each element in set.  It is expanded with the next available BOOST_PP_FOR repetition, the auxiliary data, the index of the current element, and the current element.
data
Auxiliary data passed to macro.
set
The set for which macro will be invoked on each element.

Remarks

This macro is a repetition construct.  If set is (a)(b)(c), it expands to the sequence:
macro(r, data, 0, a) macro(r, data, 1, b) macro(r, data, 2, c)
For maximum efficiency, use BOOST_PP_SET_FOR_EACH_I_R

See Also

Requirements

Header:  <boost/preprocessor/set/for_each_i.hpp>

Sample Code

#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/set/for_each_i.hpp>

#define SET (a)(b)(c)(d)

#define MACRO(r, data, i, elem) BOOST_PP_CAT(elem, BOOST_PP_CAT(data, i))

BOOST_PP_SET_FOR_EACH_I(MACRO, _, SET) // expands to a_0 b_1 c_2 d_3