File indexing completed on 2025-01-18 09:50:26
0001 #if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES)
0002
0003 #ifndef BOOST_NO_CXX11_VARIADIC_TEMPLATES
0004 #include <boost/proto/detail/preprocessed/expr_variadic.hpp>
0005 #else
0006 #include <boost/proto/detail/preprocessed/expr.hpp>
0007 #endif
0008
0009 #elif !defined(BOOST_PP_IS_ITERATING)
0010
0011
0012
0013 #define BOOST_PROTO_CHILD(Z, N, DATA) \
0014 typedef BOOST_PP_CAT(Arg, N) BOOST_PP_CAT(proto_child, N); \
0015 BOOST_PP_CAT(proto_child, N) BOOST_PP_CAT(child, N); \
0016
0017
0018
0019
0020 #define BOOST_PROTO_VOID(Z, N, DATA) \
0021 typedef void BOOST_PP_CAT(proto_child, N); \
0022
0023
0024
0025 #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
0026 #pragma wave option(preserve: 2, line: 0, output: "preprocessed/expr_variadic.hpp")
0027 #endif
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037 #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
0038 #pragma wave option(preserve: 1)
0039 #endif
0040
0041
0042 #define BOOST_PROTO_DEFINE_TERMINAL
0043 #define BOOST_PP_ITERATION_PARAMS_1 \
0044 (3, (0, 0, <boost/proto/detail/expr.hpp>))
0045 #include BOOST_PP_ITERATE()
0046
0047 #undef BOOST_PROTO_DEFINE_TERMINAL
0048 #define BOOST_PP_ITERATION_PARAMS_1 \
0049 (3, (1, BOOST_PROTO_MAX_ARITY, <boost/proto/detail/expr.hpp>))
0050 #include BOOST_PP_ITERATE()
0051
0052
0053 #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
0054 #define BOOST_NO_CXX11_VARIADIC_TEMPLATES
0055 #pragma wave option(preserve: 2, line: 0, output: "preprocessed/expr.hpp")
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065 #pragma wave option(preserve: 1)
0066
0067
0068 #define BOOST_PROTO_DEFINE_TERMINAL
0069 #define BOOST_PP_ITERATION_PARAMS_1 (3, (0, 0, <boost/proto/detail/expr.hpp>))
0070 #include BOOST_PP_ITERATE()
0071
0072 #undef BOOST_PROTO_DEFINE_TERMINAL
0073 #define BOOST_PP_ITERATION_PARAMS_1 (3, (1, BOOST_PROTO_MAX_ARITY, <boost/proto/detail/expr.hpp>))
0074 #include BOOST_PP_ITERATE()
0075
0076 #pragma wave option(output: null)
0077 #undef BOOST_NO_CXX11_VARIADIC_TEMPLATES
0078 #endif
0079
0080 #undef BOOST_PROTO_CHILD
0081 #undef BOOST_PROTO_VOID
0082
0083 #else
0084
0085 #define ARG_COUNT BOOST_PP_MAX(1, BOOST_PP_ITERATION())
0086
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114 #ifdef BOOST_PROTO_DEFINE_TERMINAL
0115 template<typename Tag, typename Arg0>
0116 struct expr<Tag, term<Arg0>, 0>
0117 #else
0118 template<typename Tag BOOST_PP_ENUM_TRAILING_PARAMS(ARG_COUNT, typename Arg)>
0119 struct expr<Tag, BOOST_PP_CAT(list, BOOST_PP_ITERATION())<BOOST_PP_ENUM_PARAMS(ARG_COUNT, Arg)>, BOOST_PP_ITERATION() >
0120 #endif
0121 {
0122 typedef Tag proto_tag;
0123 static const long proto_arity_c = BOOST_PP_ITERATION();
0124 typedef mpl::long_<BOOST_PP_ITERATION() > proto_arity;
0125 typedef expr proto_base_expr;
0126 #ifdef BOOST_PROTO_DEFINE_TERMINAL
0127 typedef term<Arg0> proto_args;
0128 #else
0129 typedef BOOST_PP_CAT(list, BOOST_PP_ITERATION())<BOOST_PP_ENUM_PARAMS(ARG_COUNT, Arg)> proto_args;
0130 #endif
0131 typedef basic_expr<Tag, proto_args, BOOST_PP_ITERATION() > proto_grammar;
0132 typedef default_domain proto_domain;
0133 typedef default_generator proto_generator;
0134 typedef proto::tag::proto_expr<Tag, proto_domain> fusion_tag;
0135 typedef expr proto_derived_expr;
0136 typedef void proto_is_expr_;
0137
0138 BOOST_PP_REPEAT(ARG_COUNT, BOOST_PROTO_CHILD, ~)
0139 BOOST_PP_REPEAT_FROM_TO(ARG_COUNT, BOOST_PROTO_MAX_ARITY, BOOST_PROTO_VOID, ~)
0140
0141
0142
0143 BOOST_FORCEINLINE
0144 expr const &proto_base() const
0145 {
0146 return *this;
0147 }
0148
0149
0150
0151 BOOST_FORCEINLINE
0152 expr &proto_base()
0153 {
0154 return *this;
0155 }
0156
0157 #ifdef BOOST_PROTO_DEFINE_TERMINAL
0158
0159
0160
0161 template<typename A0>
0162 BOOST_FORCEINLINE
0163 static expr const make(A0 &a0)
0164 {
0165 return detail::make_terminal(a0, static_cast<expr *>(0), static_cast<proto_args *>(0));
0166 }
0167
0168
0169
0170 template<typename A0>
0171 BOOST_FORCEINLINE
0172 static expr const make(A0 const &a0)
0173 {
0174 return detail::make_terminal(a0, static_cast<expr *>(0), static_cast<proto_args *>(0));
0175 }
0176 #else
0177
0178
0179
0180 template<BOOST_PP_ENUM_PARAMS(ARG_COUNT, typename A)>
0181 BOOST_FORCEINLINE
0182 static expr const make(BOOST_PP_ENUM_BINARY_PARAMS(ARG_COUNT, A, const &a))
0183 {
0184 expr that = {BOOST_PP_ENUM_PARAMS(ARG_COUNT, a)};
0185 return that;
0186 }
0187 #endif
0188
0189 #if 1 == BOOST_PP_ITERATION()
0190
0191
0192
0193 typedef typename detail::address_of_hack<Tag, proto_child0>::type address_of_hack_type_;
0194
0195
0196
0197
0198
0199
0200
0201
0202 BOOST_FORCEINLINE
0203 operator address_of_hack_type_() const
0204 {
0205 return boost::addressof(this->child0);
0206 }
0207 #else
0208
0209
0210 typedef detail::not_a_valid_type address_of_hack_type_;
0211 #endif
0212
0213
0214
0215
0216
0217 BOOST_FORCEINLINE
0218 proto::expr<
0219 proto::tag::assign
0220 , list2<expr &, expr const &>
0221 , 2
0222 > const
0223 operator =(expr const &a)
0224 {
0225 proto::expr<
0226 proto::tag::assign
0227 , list2<expr &, expr const &>
0228 , 2
0229 > that = {*this, a};
0230 return that;
0231 }
0232
0233
0234
0235
0236
0237 template<typename A>
0238 BOOST_FORCEINLINE
0239 proto::expr<
0240 proto::tag::assign
0241 , list2<expr const &, typename result_of::as_child<A>::type>
0242 , 2
0243 > const
0244 operator =(A &a) const
0245 {
0246 proto::expr<
0247 proto::tag::assign
0248 , list2<expr const &, typename result_of::as_child<A>::type>
0249 , 2
0250 > that = {*this, proto::as_child(a)};
0251 return that;
0252 }
0253
0254
0255
0256 template<typename A>
0257 BOOST_FORCEINLINE
0258 proto::expr<
0259 proto::tag::assign
0260 , list2<expr const &, typename result_of::as_child<A const>::type>
0261 , 2
0262 > const
0263 operator =(A const &a) const
0264 {
0265 proto::expr<
0266 proto::tag::assign
0267 , list2<expr const &, typename result_of::as_child<A const>::type>
0268 , 2
0269 > that = {*this, proto::as_child(a)};
0270 return that;
0271 }
0272
0273 #ifdef BOOST_PROTO_DEFINE_TERMINAL
0274
0275
0276 template<typename A>
0277 BOOST_FORCEINLINE
0278 proto::expr<
0279 proto::tag::assign
0280 , list2<expr &, typename result_of::as_child<A>::type>
0281 , 2
0282 > const
0283 operator =(A &a)
0284 {
0285 proto::expr<
0286 proto::tag::assign
0287 , list2<expr &, typename result_of::as_child<A>::type>
0288 , 2
0289 > that = {*this, proto::as_child(a)};
0290 return that;
0291 }
0292
0293
0294
0295 template<typename A>
0296 BOOST_FORCEINLINE
0297 proto::expr<
0298 proto::tag::assign
0299 , list2<expr &, typename result_of::as_child<A const>::type>
0300 , 2
0301 > const
0302 operator =(A const &a)
0303 {
0304 proto::expr<
0305 proto::tag::assign
0306 , list2<expr &, typename result_of::as_child<A const>::type>
0307 , 2
0308 > that = {*this, proto::as_child(a)};
0309 return that;
0310 }
0311 #endif
0312
0313
0314
0315
0316
0317 template<typename A>
0318 BOOST_FORCEINLINE
0319 proto::expr<
0320 proto::tag::subscript
0321 , list2<expr const &, typename result_of::as_child<A>::type>
0322 , 2
0323 > const
0324 operator [](A &a) const
0325 {
0326 proto::expr<
0327 proto::tag::subscript
0328 , list2<expr const &, typename result_of::as_child<A>::type>
0329 , 2
0330 > that = {*this, proto::as_child(a)};
0331 return that;
0332 }
0333
0334
0335
0336 template<typename A>
0337 BOOST_FORCEINLINE
0338 proto::expr<
0339 proto::tag::subscript
0340 , list2<expr const &, typename result_of::as_child<A const>::type>
0341 , 2
0342 > const
0343 operator [](A const &a) const
0344 {
0345 proto::expr<
0346 proto::tag::subscript
0347 , list2<expr const &, typename result_of::as_child<A const>::type>
0348 , 2
0349 > that = {*this, proto::as_child(a)};
0350 return that;
0351 }
0352
0353 #ifdef BOOST_PROTO_DEFINE_TERMINAL
0354
0355
0356 template<typename A>
0357 BOOST_FORCEINLINE
0358 proto::expr<
0359 proto::tag::subscript
0360 , list2<expr &, typename result_of::as_child<A>::type>
0361 , 2
0362 > const
0363 operator [](A &a)
0364 {
0365 proto::expr<
0366 proto::tag::subscript
0367 , list2<expr &, typename result_of::as_child<A>::type>
0368 , 2
0369 > that = {*this, proto::as_child(a)};
0370 return that;
0371 }
0372
0373
0374
0375 template<typename A>
0376 BOOST_FORCEINLINE
0377 proto::expr<
0378 proto::tag::subscript
0379 , list2<expr &, typename result_of::as_child<A const>::type>
0380 , 2
0381 > const
0382 operator [](A const &a)
0383 {
0384 proto::expr<
0385 proto::tag::subscript
0386 , list2<expr &, typename result_of::as_child<A const>::type>
0387 , 2
0388 > that = {*this, proto::as_child(a)};
0389 return that;
0390 }
0391 #endif
0392
0393
0394
0395 template<typename Sig>
0396 struct result
0397 {
0398 typedef typename result_of::funop<Sig, expr, default_domain>::type const type;
0399 };
0400
0401 #ifndef BOOST_NO_CXX11_VARIADIC_TEMPLATES
0402
0403
0404 template<typename ...A>
0405 BOOST_FORCEINLINE
0406 typename result_of::funop<
0407 expr const(A const &...)
0408 , expr
0409 , default_domain
0410 >::type const
0411 operator ()(A const &... a) const
0412 {
0413 return result_of::funop<
0414 expr const(A const &...)
0415 , expr
0416 , default_domain
0417 >::call(*this, a...);
0418 }
0419
0420 #ifdef BOOST_PROTO_DEFINE_TERMINAL
0421
0422
0423 template<typename ...A>
0424 BOOST_FORCEINLINE
0425 typename result_of::funop<
0426 expr(A const &...)
0427 , expr
0428 , default_domain
0429 >::type const
0430 operator ()(A const &... a)
0431 {
0432 return result_of::funop<
0433 expr(A const &...)
0434 , expr
0435 , default_domain
0436 >::call(*this, a...);
0437 }
0438 #endif
0439
0440 #else
0441
0442
0443
0444
0445 BOOST_FORCEINLINE
0446 proto::expr<proto::tag::function, list1<expr const &>, 1> const
0447 operator ()() const
0448 {
0449 proto::expr<proto::tag::function, list1<expr const &>, 1> that = {*this};
0450 return that;
0451 }
0452
0453 #ifdef BOOST_PROTO_DEFINE_TERMINAL
0454
0455
0456 BOOST_FORCEINLINE
0457 proto::expr<proto::tag::function, list1<expr &>, 1> const
0458 operator ()()
0459 {
0460 proto::expr<proto::tag::function, list1<expr &>, 1> that = {*this};
0461 return that;
0462 }
0463 #endif
0464
0465 #define BOOST_PP_ITERATION_PARAMS_2 \
0466 (3, (1, BOOST_PP_DEC(BOOST_PROTO_MAX_FUNCTION_CALL_ARITY), <boost/proto/detail/expr_funop.hpp>))
0467 #include BOOST_PP_ITERATE()
0468
0469 #endif
0470 };
0471
0472 #undef ARG_COUNT
0473
0474 #endif