The BOOST_PP_LIST_REVERSE_D macro expands to the reverse a list.  It reenters BOOST_PP_WHILE with maximum efficiency.

Usage

BOOST_PP_LIST_REVERSE_D(d, list)

Arguments

d
The next available BOOST_PP_WHILE iteration.
list
A list to be reversed.

See Also

Requirements

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

Sample Code

#include <boost/preprocessor/list/fold_right.hpp>
#include <boost/preprocessor/list/reverse.hpp>

#define L1 (a, (b, (c, (d, BOOST_PP_NIL))))
#define L2 (L1, (L1, (L1, BOOST_PP_NIL)))

#define OP(d, state, x) (BOOST_PP_LIST_REVERSE_D(d, x), state)

BOOST_PP_LIST_FOLD_RIGHT(OP, BOOST_PP_NIL, L2)
/*
   expands to...
   ((d, (c, (b, (a, BOOST_PP_NIL)))), ((d, (c, (b, (a, BOOST_PP_NIL)))),
   ((d, (c, (b, (a, 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)