#include <boost/preprocessor/list/adt.hpp> #include <boost/preprocessor/repetition/for.hpp> #include <boost/preprocessor/list/enum.hpp> #define LIST (x, (y, (z, BOOST_PP_NIL))) #define PRED(r, state) BOOST_PP_LIST_IS_CONS(state) #define OP(r, state) BOOST_PP_LIST_REST(state) #define MACRO(r, state) [ BOOST_PP_LIST_ENUM_R(r, state) ] BOOST_PP_FOR(LIST, PRED, OP, MACRO) // expands to [x, y, z] [y, z] [z]
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)