#include <boost/preprocessor/arithmetic/add.hpp> #include <boost/preprocessor/list/fold_left.hpp> #include <boost/preprocessor/list/size.hpp> #define L1 (a, (b, (c, BOOST_PP_NIL))) #define L2 (x, (y, BOOST_PP_NIL)) #define L3 (p, (q, BOOST_PP_NIL)) #define LIST (L1, (L2, (L3, BOOST_PP_NIL))) #define OP(d, state, x) \ BOOST_PP_ADD_D( \ d, state, \ BOOST_PP_LIST_SIZE_D(d, x) \ ) \ /**/ BOOST_PP_LIST_FOLD_LEFT(OP, 0, LIST) // expands to 7
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)