1 # /* ************************************************************************** 2 # * * 3 # * (C) Copyright Paul Mensonides 2002. 4 # * Distributed under the Boost Software License, Version 1.0. (See 5 # * accompanying file LICENSE_1_0.txt or copy at 6 # * http://www.boost.org/LICENSE_1_0.txt) 7 # * * 8 # ************************************************************************** */ 9 # 10 # /* See http://www.boost.org for most recent version. */ 11 # 12 # ifndef BOOST_PREPROCESSOR_SEQ_CAT_HPP 13 # define BOOST_PREPROCESSOR_SEQ_CAT_HPP 14 # 15 # include <boost/preprocessor/arithmetic/dec.hpp> 16 # include <boost/preprocessor/config/config.hpp> 17 # include <boost/preprocessor/control/if.hpp> 18 # include <boost/preprocessor/seq/fold_left.hpp> 19 # include <boost/preprocessor/seq/seq.hpp> 20 # include <boost/preprocessor/seq/size.hpp> 21 # include <boost/preprocessor/tuple/eat.hpp> 22 # 23 # /* BOOST_PP_SEQ_CAT */ 24 # 25 # define BOOST_PP_SEQ_CAT(seq) \ 26 BOOST_PP_IF( \ 27 BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(seq)), \ 28 BOOST_PP_SEQ_CAT_I, \ 29 BOOST_PP_SEQ_HEAD \ 30 )(seq) \ 31 /**/ 32 # define BOOST_PP_SEQ_CAT_I(seq) BOOST_PP_SEQ_FOLD_LEFT(BOOST_PP_SEQ_CAT_O, BOOST_PP_SEQ_HEAD(seq), BOOST_PP_SEQ_TAIL(seq)) 33 # 34 # define BOOST_PP_SEQ_CAT_O(s, st, elem) BOOST_PP_SEQ_CAT_O_I(st, elem) 35 # define BOOST_PP_SEQ_CAT_O_I(a, b) a ## b 36 # 37 # /* BOOST_PP_SEQ_CAT_S */ 38 # 39 # define BOOST_PP_SEQ_CAT_S(s, seq) \ 40 BOOST_PP_IF( \ 41 BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(seq)), \ 42 BOOST_PP_SEQ_CAT_S_I_A, \ 43 BOOST_PP_SEQ_CAT_S_I_B \ 44 )(s, seq) \ 45 /**/ 46 # define BOOST_PP_SEQ_CAT_S_I_A(s, seq) BOOST_PP_SEQ_FOLD_LEFT_ ## s(BOOST_PP_SEQ_CAT_O, BOOST_PP_SEQ_HEAD(seq), BOOST_PP_SEQ_TAIL(seq)) 47 # define BOOST_PP_SEQ_CAT_S_I_B(s, seq) BOOST_PP_SEQ_HEAD(seq) 48 # 49 # endif 50