The BOOST_PP_LIST_TRANSFORM_D macro transforms each element in a list according to a supplied transformation. It reenters BOOST_PP_WHILE with maximum efficiency.

#### Usage

BOOST_PP_LIST_TRANSFORM_D(d, op, data, list)

#### Arguments

d
  The next available BOOST_PP_WHILE iteration.
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)))

#### See Also

- BOOST_PP_LIST_TRANSFORM

#### Requirements

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

#### Sample Code

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

    #define A (1, (2, (3, (4, BOOST_PP_NIL))))
    #define B (A, (A, (A, (A, BOOST_PP_NIL))))

    #define OP_T(d, data, x) BOOST_PP_INC(x)
    #define OP(d, state, x) (BOOST_PP_LIST_TRANSFORM_D(d, OP_T, 2, x), state)

    BOOST_PP_LIST_FOLD_RIGHT(OP, BOOST_PP_NIL, B)
    /*
       expands to:
       ((2, (3, (4, (5, BOOST_PP_NIL)))), ((2, (3, (4, (5, BOOST_PP_NIL)))),
       ((2, (3, (4, (5, BOOST_PP_NIL)))), ((2, (3, (4, (5, BOOST_PP_NIL)))),
       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)