File indexing completed on 2025-01-18 09:40:49
0001 #ifndef BOOST_METAPARSE_V1_SEQUENCE_APPLY_HPP
0002 #define BOOST_METAPARSE_V1_SEQUENCE_APPLY_HPP
0003
0004
0005
0006
0007
0008
0009 #include <boost/metaparse/v1/letter.hpp>
0010 #include <boost/metaparse/v1/sequence.hpp>
0011
0012 #include <boost/metaparse/limit_sequence_size.hpp>
0013
0014 #include <boost/mpl/at.hpp>
0015
0016 #include <boost/preprocessor/cat.hpp>
0017 #include <boost/preprocessor/repetition/repeat_from_to.hpp>
0018 #include <boost/preprocessor/repetition/enum.hpp>
0019 #include <boost/preprocessor/repetition/enum_params.hpp>
0020 #include <boost/preprocessor/tuple/eat.hpp>
0021
0022 namespace boost
0023 {
0024 namespace metaparse
0025 {
0026 namespace v1
0027 {
0028 #ifdef BOOST_METAPARSE_SEQUENCE_APPLY_ARG
0029 # error BOOST_METAPARSE_SEQUENCE_APPLY_ARG already defined
0030 #endif
0031 #define BOOST_METAPARSE_SEQUENCE_APPLY_ARG(z, n, container) \
0032 typename boost::mpl::at_c<container, n>::type
0033
0034 #ifdef BOOST_METAPARSE_SEQUENCE_APPLY
0035 # error BOOST_METAPARSE_SEQUENCE_APPLY already defined
0036 #endif
0037 #define BOOST_METAPARSE_SEQUENCE_APPLY(z, n, unused) \
0038 namespace impl \
0039 { \
0040 template < \
0041 template <BOOST_PP_ENUM(n, class BOOST_PP_TUPLE_EAT(3), ~)> class T \
0042 > \
0043 struct BOOST_PP_CAT(sequence_apply_transform, n) \
0044 { \
0045 typedef BOOST_PP_CAT(sequence_apply_transform, n) type; \
0046 \
0047 template <class V> \
0048 struct apply \
0049 { \
0050 typedef T<BOOST_PP_ENUM(n, BOOST_METAPARSE_SEQUENCE_APPLY_ARG, V)> type; \
0051 }; \
0052 }; \
0053 } \
0054 \
0055 template < \
0056 template <BOOST_PP_ENUM(n, class BOOST_PP_TUPLE_EAT(3), ~)> class T, \
0057 BOOST_PP_ENUM_PARAMS(n, class P) \
0058 > \
0059 struct BOOST_PP_CAT(sequence_apply, n) : \
0060 transform< \
0061 sequence<BOOST_PP_ENUM_PARAMS(n, P)>, \
0062 BOOST_PP_CAT(impl::sequence_apply_transform, n)<T> \
0063 > \
0064 {};
0065
0066 BOOST_PP_REPEAT_FROM_TO(
0067 1,
0068 BOOST_METAPARSE_LIMIT_SEQUENCE_SIZE,
0069 BOOST_METAPARSE_SEQUENCE_APPLY,
0070 ~
0071 )
0072
0073 #undef BOOST_METAPARSE_SEQUENCE_APPLY
0074 #undef BOOST_METAPARSE_SEQUENCE_APPLY_ARG
0075 }
0076 }
0077 }
0078
0079 #endif
0080