#include <boost/preprocessor/list/first_n.hpp> #include <boost/preprocessor/list/fold_right.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_FIRST_N_D(d, 2, x), state) BOOST_PP_LIST_FOLD_RIGHT(OP, BOOST_PP_NIL, L2) /* expands to... ((a, (b, BOOST_PP_NIL)), ((a, (b, BOOST_PP_NIL)), ((a, (b, BOOST_PP_NIL)) , BOOST_PP_NIL ))) */
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)