File indexing completed on 2025-01-18 09:50:27
0001 #if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES)
0002
0003 #include <boost/proto/detail/preprocessed/unpack_expr_.hpp>
0004
0005 #elif !defined(BOOST_PP_IS_ITERATING)
0006
0007
0008
0009 #define BOOST_PROTO_FUSION_NEXT_ITERATOR_TYPE(Z, N, DATA) \
0010 typedef typename fusion::result_of::next< \
0011 BOOST_PP_CAT(fusion_iterator, N)>::type \
0012 BOOST_PP_CAT(fusion_iterator, BOOST_PP_INC(N)); \
0013
0014
0015
0016
0017 #define BOOST_PROTO_FUSION_ITERATORS_TYPE(N) \
0018 typedef \
0019 typename fusion::result_of::begin<Sequence const>::type \
0020 fusion_iterator0; \
0021 BOOST_PP_REPEAT(BOOST_PP_DEC(N), BOOST_PROTO_FUSION_NEXT_ITERATOR_TYPE, fusion_iterator) \
0022
0023
0024
0025
0026 #define BOOST_PROTO_FUSION_AT_TYPE(Z, N, DATA) \
0027 typename add_const< \
0028 typename fusion::result_of::value_of< \
0029 BOOST_PP_CAT(fusion_iterator, N) \
0030 >::type \
0031 >::type \
0032
0033
0034
0035
0036 #define BOOST_PROTO_FUSION_NEXT_ITERATOR(Z, N, DATA) \
0037 BOOST_PP_CAT(fusion_iterator, BOOST_PP_INC(N)) BOOST_PP_CAT(it, BOOST_PP_INC(N)) = \
0038 fusion::next(BOOST_PP_CAT(it, N)); \
0039
0040
0041
0042
0043 #define BOOST_PROTO_FUSION_ITERATORS(N) \
0044 fusion_iterator0 it0 = fusion::begin(sequence); \
0045 BOOST_PP_REPEAT(BOOST_PP_DEC(N), BOOST_PROTO_FUSION_NEXT_ITERATOR, fusion_iterator) \
0046
0047
0048
0049
0050 #define BOOST_PROTO_FUSION_AT(Z, N, DATA) \
0051 *BOOST_PP_CAT(it, N) \
0052
0053
0054
0055
0056 #define BOOST_PROTO_FUSION_AS_CHILD_AT_TYPE(Z, N, DATA) \
0057 typename detail::protoify< \
0058 BOOST_PROTO_FUSION_AT_TYPE(Z, N, DATA) \
0059 , Domain \
0060 >::result_type \
0061
0062
0063
0064
0065 #define BOOST_PROTO_FUSION_AS_CHILD_AT(Z, N, DATA) \
0066 detail::protoify< \
0067 BOOST_PROTO_FUSION_AT_TYPE(Z, N, DATA) \
0068 , Domain \
0069 >()(BOOST_PROTO_FUSION_AT(Z, N, DATA)) \
0070
0071
0072 #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
0073 #pragma wave option(preserve: 2, line: 0, output: "preprocessed/unpack_expr_.hpp")
0074 #endif
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084 #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
0085 #pragma wave option(preserve: 1)
0086 #endif
0087
0088 template<typename Tag, typename Domain, typename Sequence, std::size_t Size>
0089 struct unpack_expr_
0090 {};
0091
0092 template<typename Domain, typename Sequence>
0093 struct unpack_expr_<tag::terminal, Domain, Sequence, 1u>
0094 {
0095 typedef
0096 typename add_const<
0097 typename fusion::result_of::value_of<
0098 typename fusion::result_of::begin<Sequence>::type
0099 >::type
0100 >::type
0101 terminal_type;
0102
0103 typedef
0104 typename proto::detail::protoify<
0105 terminal_type
0106 , Domain
0107 >::result_type
0108 type;
0109
0110 BOOST_FORCEINLINE
0111 static type const call(Sequence const &sequence)
0112 {
0113 return proto::detail::protoify<terminal_type, Domain>()(fusion::at_c<0>(sequence));
0114 }
0115 };
0116
0117 template<typename Sequence>
0118 struct unpack_expr_<tag::terminal, deduce_domain, Sequence, 1u>
0119 : unpack_expr_<tag::terminal, default_domain, Sequence, 1u>
0120 {};
0121
0122 #define BOOST_PP_ITERATION_PARAMS_1 \
0123 (3, (1, BOOST_PROTO_MAX_ARITY, <boost/proto/detail/unpack_expr_.hpp>))
0124 #include BOOST_PP_ITERATE()
0125
0126 #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
0127 #pragma wave option(output: null)
0128 #endif
0129
0130 #undef BOOST_PROTO_FUSION_AT
0131 #undef BOOST_PROTO_FUSION_AT_TYPE
0132 #undef BOOST_PROTO_FUSION_AS_CHILD_AT
0133 #undef BOOST_PROTO_FUSION_AS_CHILD_AT_TYPE
0134 #undef BOOST_PROTO_FUSION_NEXT_ITERATOR
0135 #undef BOOST_PROTO_FUSION_NEXT_ITERATOR_TYPE
0136 #undef BOOST_PROTO_FUSION_ITERATORS
0137 #undef BOOST_PROTO_FUSION_ITERATORS_TYPE
0138
0139 #else
0140
0141 #define N BOOST_PP_ITERATION()
0142 #define M BOOST_PP_SUB(BOOST_PROTO_MAX_ARITY, N)
0143
0144 template<typename Tag, typename Domain, typename Sequence>
0145 struct unpack_expr_<Tag, Domain, Sequence, N>
0146 {
0147 BOOST_PROTO_FUSION_ITERATORS_TYPE(N)
0148
0149 typedef
0150 BOOST_PP_CAT(list, N)<
0151 BOOST_PP_ENUM(N, BOOST_PROTO_FUSION_AS_CHILD_AT_TYPE, ~)
0152 >
0153 proto_args;
0154
0155 typedef typename base_expr<Domain, Tag, proto_args>::type expr_type;
0156 typedef typename Domain::proto_generator proto_generator;
0157 typedef typename proto_generator::template result<proto_generator(expr_type)>::type type;
0158
0159 BOOST_FORCEINLINE
0160 static type const call(Sequence const &sequence)
0161 {
0162 BOOST_PROTO_FUSION_ITERATORS(N)
0163 expr_type const that = {
0164 BOOST_PP_ENUM(N, BOOST_PROTO_FUSION_AS_CHILD_AT, ~)
0165 };
0166 return proto_generator()(that);
0167 }
0168 };
0169
0170 template<typename Tag, typename Sequence>
0171 struct unpack_expr_<Tag, deduce_domain, Sequence, N>
0172 {
0173 BOOST_PROTO_FUSION_ITERATORS_TYPE(N)
0174
0175 typedef
0176 unpack_expr_<
0177 Tag
0178 , typename BOOST_PP_CAT(deduce_domain, N)<
0179 BOOST_PP_ENUM(N, BOOST_PROTO_FUSION_AT_TYPE, ~)
0180 >::type
0181 , Sequence
0182 , N
0183 >
0184 other;
0185
0186 typedef typename other::type type;
0187
0188 BOOST_FORCEINLINE
0189 static type const call(Sequence const &sequence)
0190 {
0191 return other::call(sequence);
0192 }
0193 };
0194
0195 #undef N
0196 #undef M
0197
0198 #endif