The BOOST_PP_SEQ_TRANSFORM macro transforms each element in a seq according to a supplied transformation.

Usage

BOOST_PP_SEQ_TRANSFORM(op, data, seq)

Arguments

op
A ternary predicate of the form op(s, data, elem).  This transformation is expanded by BOOST_PP_SEQ_TRANSFORM for each element in seq with the next available BOOST_PP_SEQ_FOLD_LEFT fold step, the auxiliary data, and the current element in seq
data
Auxiliary data passed to pred.
seq
The seq to be transformed.

Remarks

This macro expands op for each element in seq.  It builds a new seq out of the results of each call.  If, for example, seq is (a)(b)(c), this macro expands to...
(op(d, data, a))(op(d, data, b))(op(d, data, c))
For maximum efficiency, use BOOST_PP_SEQ_TRANSFORM_S.

See Also

Requirements

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

Sample Code

#include <boost/preprocessor/arithmetic/dec.hpp>
#include <boost/preprocessor/seq/transform.hpp>

#define SEQ (1)(3)(2)(5)

#define OP(s, data, elem) BOOST_PP_DEC(elem)

BOOST_PP_SEQ_TRANSFORM(OP, 3, SEQ)
   // expands to (0)(2)(1)(4)

© 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)