BOOST_PP_LIST_TRANSFORM

The BOOST_PP_LIST_TRANSFORM macro transforms each element in a list according to a supplied transformation.

#### Usage

BOOST_PP_LIST_TRANSFORM(op, data, list)

#### Arguments

op
  A ternary predicate of the form op(d, data, elem). This transformation is expanded by BOOST_PP_LIST_TRANSFORM for each element in list with the next available BOOST_PP_WHILE iteration, the auxiliary data, and the current element in list.
data
  Auxiliary data passed to pred.
list
  The list to be transformed.

#### Remarks

This macro expands op for each element in list. It builds a new list out of the results of each call. If, for example, list is (a, (b, (c, BOOST_PP_NIL))), this macro expands to...
(op(d, data, a), (op(d, data, b), (op(d, data, c), BOOST_PP_NIL)))
Previously, this macro could not be used inside BOOST_PP_WHILE. There is no longer any such restriction. It is more efficient, however, to use BOOST_PP_LIST_TRANSFORM_D in such a situation.

#### See Also

- BOOST_PP_LIST_TRANSFORM_D

#### Requirements

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

#### Sample Code

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

    #define LIST (1, (3, (2, (5, BOOST_PP_NIL))))

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

    BOOST_PP_LIST_TRANSFORM(OP, 3, LIST)
       // expands to (0, (2, (1, (4, BOOST_PP_NIL))))

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