1 #ifndef BOOST_METAPARSE_V1_SEQUENCE_APPLY_HPP
2 #define BOOST_METAPARSE_V1_SEQUENCE_APPLY_HPP
4 // Copyright Abel Sinkovics (abel@sinkovics.hu) 2015.
5 // Distributed under the Boost Software License, Version 1.0.
6 // (See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
9 #include <boost/metaparse/v1/letter.hpp>
10 #include <boost/metaparse/v1/sequence.hpp>
12 #include <boost/metaparse/limit_sequence_size.hpp>
14 #include <boost/mpl/at.hpp>
16 #include <boost/preprocessor/cat.hpp>
17 #include <boost/preprocessor/repetition/repeat_from_to.hpp>
18 #include <boost/preprocessor/repetition/enum.hpp>
19 #include <boost/preprocessor/repetition/enum_params.hpp>
20 #include <boost/preprocessor/tuple/eat.hpp>
28 #ifdef BOOST_METAPARSE_SEQUENCE_APPLY_ARG
29 # error BOOST_METAPARSE_SEQUENCE_APPLY_ARG already defined
31 #define BOOST_METAPARSE_SEQUENCE_APPLY_ARG(z, n, container) \
32 typename boost::mpl::at_c<container, n>::type
34 #ifdef BOOST_METAPARSE_SEQUENCE_APPLY
35 # error BOOST_METAPARSE_SEQUENCE_APPLY already defined
37 #define BOOST_METAPARSE_SEQUENCE_APPLY(z, n, unused) \
41 template <BOOST_PP_ENUM(n, class BOOST_PP_TUPLE_EAT(3), ~)> class T \
43 struct BOOST_PP_CAT(sequence_apply_transform, n) \
45 typedef BOOST_PP_CAT(sequence_apply_transform, n) type; \
50 typedef T<BOOST_PP_ENUM(n, BOOST_METAPARSE_SEQUENCE_APPLY_ARG, V)> type; \
56 template <BOOST_PP_ENUM(n, class BOOST_PP_TUPLE_EAT(3), ~)> class T, \
57 BOOST_PP_ENUM_PARAMS(n, class P) \
59 struct BOOST_PP_CAT(sequence_apply, n) : \
61 sequence<BOOST_PP_ENUM_PARAMS(n, P)>, \
62 BOOST_PP_CAT(impl::sequence_apply_transform, n)<T> \
66 BOOST_PP_REPEAT_FROM_TO(
68 BOOST_METAPARSE_LIMIT_SEQUENCE_SIZE,
69 BOOST_METAPARSE_SEQUENCE_APPLY,
73 #undef BOOST_METAPARSE_SEQUENCE_APPLY
74 #undef BOOST_METAPARSE_SEQUENCE_APPLY_ARG