File indexing completed on 2025-01-18 09:50:19
0001 #if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES)
0002
0003 #include <boost/proto/context/detail/preprocessed/callable_eval.hpp>
0004
0005 #elif !defined(BOOST_PP_IS_ITERATING)
0006
0007 #define BOOST_PROTO_CHILD_N_TYPE(Z, N, Expr) \
0008 typedef typename proto::result_of::child_c<Expr const &, N>::type BOOST_PP_CAT(child, N); \
0009
0010
0011 #define BOOST_PROTO_CHILD_N(Z, N, expr) \
0012 proto::child_c<N>(expr) \
0013
0014
0015 #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
0016 #pragma wave option(preserve: 2, line: 0, output: "preprocessed/callable_eval.hpp")
0017 #endif
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027 #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
0028 #pragma wave option(preserve: 1)
0029 #endif
0030
0031 #define BOOST_PP_ITERATION_PARAMS_1 \
0032 (3, (1, BOOST_PROTO_MAX_ARITY, <boost/proto/context/detail/callable_eval.hpp>))
0033 #include BOOST_PP_ITERATE()
0034
0035 #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
0036 #pragma wave option(output: null)
0037 #endif
0038
0039 #undef BOOST_PROTO_CHILD_N_TYPE
0040 #undef BOOST_PROTO_CHILD_N
0041
0042 #else
0043
0044 #define N BOOST_PP_ITERATION()
0045
0046 namespace detail
0047 {
0048 template<typename Expr, typename Context>
0049 struct is_expr_handled<Expr, Context, N>
0050 {
0051 static callable_context_wrapper<Context> &sctx_;
0052 static Expr &sexpr_;
0053 static typename Expr::proto_tag &stag_;
0054
0055 static const bool value =
0056 sizeof(yes_type) ==
0057 sizeof(
0058 detail::check_is_expr_handled(
0059 (sctx_(
0060 stag_
0061 BOOST_PP_ENUM_TRAILING(N, BOOST_PROTO_CHILD_N, sexpr_)
0062 ), 0)
0063 )
0064 );
0065
0066 typedef mpl::bool_<value> type;
0067 };
0068 }
0069
0070 namespace context
0071 {
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084 template<typename Expr, typename Context>
0085 struct callable_eval<Expr, Context, N>
0086 {
0087 BOOST_PP_REPEAT(N, BOOST_PROTO_CHILD_N_TYPE, Expr)
0088
0089 typedef
0090 typename BOOST_PROTO_RESULT_OF<
0091 Context(
0092 typename Expr::proto_tag
0093 BOOST_PP_ENUM_TRAILING_PARAMS(N, child)
0094 )
0095 >::type
0096 result_type;
0097
0098
0099
0100
0101 result_type operator ()(Expr &expr, Context &context) const
0102 {
0103 return context(
0104 typename Expr::proto_tag()
0105 BOOST_PP_ENUM_TRAILING(N, BOOST_PROTO_CHILD_N, expr)
0106 );
0107 }
0108 };
0109 }
0110
0111 #undef N
0112
0113 #endif