1 #if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES)
3 #include <boost/proto/context/detail/preprocessed/callable_eval.hpp>
5 #elif !defined(BOOST_PP_IS_ITERATING)
7 #define BOOST_PROTO_CHILD_N_TYPE(Z, N, Expr) \
8 typedef typename proto::result_of::child_c<Expr const &, N>::type BOOST_PP_CAT(child, N); \
11 #define BOOST_PROTO_CHILD_N(Z, N, expr) \
12 proto::child_c<N>(expr) \
15 #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
16 #pragma wave option(preserve: 2, line: 0, output: "preprocessed/callable_eval.hpp")
19 ///////////////////////////////////////////////////////////////////////////////
20 /// \file callable_eval.hpp
21 /// Contains specializations of the callable_eval\<\> class template.
23 // Copyright 2008 Eric Niebler. Distributed under the Boost
24 // Software License, Version 1.0. (See accompanying file
25 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
27 #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
28 #pragma wave option(preserve: 1)
31 #define BOOST_PP_ITERATION_PARAMS_1 \
32 (3, (1, BOOST_PROTO_MAX_ARITY, <boost/proto/context/detail/callable_eval.hpp>))
33 #include BOOST_PP_ITERATE()
35 #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
36 #pragma wave option(output: null)
39 #undef BOOST_PROTO_CHILD_N_TYPE
40 #undef BOOST_PROTO_CHILD_N
44 #define N BOOST_PP_ITERATION()
48 template<typename Expr, typename Context>
49 struct is_expr_handled<Expr, Context, N>
51 static callable_context_wrapper<Context> &sctx_;
53 static typename Expr::proto_tag &stag_;
55 static const bool value =
58 detail::check_is_expr_handled(
61 BOOST_PP_ENUM_TRAILING(N, BOOST_PROTO_CHILD_N, sexpr_)
66 typedef mpl::bool_<value> type;
72 /// \brief A BinaryFunction that accepts a Proto expression and a
73 /// callable context and calls the context with the expression tag
74 /// and children as arguments, effectively fanning the expression
77 /// <tt>callable_eval\<\></tt> requires that \c Context is a
78 /// PolymorphicFunctionObject that can be invoked with \c Expr's
79 /// tag and children as expressions, as follows:
82 /// context(Expr::proto_tag(), child_c\<0\>(expr), child_c\<1\>(expr), ...)
84 template<typename Expr, typename Context>
85 struct callable_eval<Expr, Context, N>
87 BOOST_PP_REPEAT(N, BOOST_PROTO_CHILD_N_TYPE, Expr)
90 typename BOOST_PROTO_RESULT_OF<
92 typename Expr::proto_tag
93 BOOST_PP_ENUM_TRAILING_PARAMS(N, child)
98 /// \param expr The current expression
99 /// \param context The callable evaluation context
100 /// \return <tt>context(Expr::proto_tag(), child_c\<0\>(expr), child_c\<1\>(expr), ...)</tt>
101 result_type operator ()(Expr &expr, Context &context) const
104 typename Expr::proto_tag()
105 BOOST_PP_ENUM_TRAILING(N, BOOST_PROTO_CHILD_N, expr)