blob: 1e689b153e812079c347438fedbf5511d7d4dc14 [file] [log] [blame]
Jeff Thompsona28eed82013-08-22 16:21:10 -07001# /* **************************************************************************
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#
Jeff Thompson3d613fd2013-10-15 15:39:04 -070012# ifndef NDNBOOST_PREPROCESSOR_SEQ_CAT_HPP
13# define NDNBOOST_PREPROCESSOR_SEQ_CAT_HPP
Jeff Thompsona28eed82013-08-22 16:21:10 -070014#
15# include <ndnboost/preprocessor/arithmetic/dec.hpp>
16# include <ndnboost/preprocessor/config/config.hpp>
17# include <ndnboost/preprocessor/control/if.hpp>
18# include <ndnboost/preprocessor/seq/fold_left.hpp>
19# include <ndnboost/preprocessor/seq/seq.hpp>
20# include <ndnboost/preprocessor/seq/size.hpp>
21# include <ndnboost/preprocessor/tuple/eat.hpp>
22#
Jeff Thompson3d613fd2013-10-15 15:39:04 -070023# /* NDNBOOST_PP_SEQ_CAT */
Jeff Thompsona28eed82013-08-22 16:21:10 -070024#
Jeff Thompson3d613fd2013-10-15 15:39:04 -070025# define NDNBOOST_PP_SEQ_CAT(seq) \
26 NDNBOOST_PP_IF( \
27 NDNBOOST_PP_DEC(NDNBOOST_PP_SEQ_SIZE(seq)), \
28 NDNBOOST_PP_SEQ_CAT_I, \
29 NDNBOOST_PP_SEQ_HEAD \
Jeff Thompsona28eed82013-08-22 16:21:10 -070030 )(seq) \
31 /**/
Jeff Thompson3d613fd2013-10-15 15:39:04 -070032# define NDNBOOST_PP_SEQ_CAT_I(seq) NDNBOOST_PP_SEQ_FOLD_LEFT(NDNBOOST_PP_SEQ_CAT_O, NDNBOOST_PP_SEQ_HEAD(seq), NDNBOOST_PP_SEQ_TAIL(seq))
Jeff Thompsona28eed82013-08-22 16:21:10 -070033#
Jeff Thompson3d613fd2013-10-15 15:39:04 -070034# define NDNBOOST_PP_SEQ_CAT_O(s, st, elem) NDNBOOST_PP_SEQ_CAT_O_I(st, elem)
35# define NDNBOOST_PP_SEQ_CAT_O_I(a, b) a ## b
Jeff Thompsona28eed82013-08-22 16:21:10 -070036#
Jeff Thompson3d613fd2013-10-15 15:39:04 -070037# /* NDNBOOST_PP_SEQ_CAT_S */
Jeff Thompsona28eed82013-08-22 16:21:10 -070038#
Jeff Thompson3d613fd2013-10-15 15:39:04 -070039# define NDNBOOST_PP_SEQ_CAT_S(s, seq) \
40 NDNBOOST_PP_IF( \
41 NDNBOOST_PP_DEC(NDNBOOST_PP_SEQ_SIZE(seq)), \
42 NDNBOOST_PP_SEQ_CAT_S_I_A, \
43 NDNBOOST_PP_SEQ_CAT_S_I_B \
Jeff Thompsona28eed82013-08-22 16:21:10 -070044 )(s, seq) \
45 /**/
Jeff Thompson3d613fd2013-10-15 15:39:04 -070046# define NDNBOOST_PP_SEQ_CAT_S_I_A(s, seq) NDNBOOST_PP_SEQ_FOLD_LEFT_ ## s(NDNBOOST_PP_SEQ_CAT_O, NDNBOOST_PP_SEQ_HEAD(seq), NDNBOOST_PP_SEQ_TAIL(seq))
47# define NDNBOOST_PP_SEQ_CAT_S_I_B(s, seq) NDNBOOST_PP_SEQ_HEAD(seq)
Jeff Thompsona28eed82013-08-22 16:21:10 -070048#
49# endif