The BOOST_PP_SEQ_FOR_EACH macro repeats a macro for each element in a seq.

Usage

BOOST_PP_SEQ_FOR_EACH(macro, data, seq)

Arguments

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

Remarks

This macro is a repetition construct.  If seq is (a)(b)(c), it expands to the sequence:
macro(r, data, a) macro(r, data, b) macro(r, data, c)
For maximum efficiency, use BOOST_PP_SEQ_FOR_EACH_R.

See Also

Requirements

Header:  <boost/preprocessor/seq/for_each.hpp>

Sample Code

#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/seq/for_each.hpp>

#define SEQ (w)(x)(y)(z)

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

BOOST_PP_SEQ_FOR_EACH(MACRO, _, SEQ) // expands to w_ x_ y_ z_

© Copyright Housemarque Oy 2002
© Copyright Paul Mensonides 2002

Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at www.boost.org/LICENSE_1_0.txt)