1 #if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES)
3 #include <boost/proto/transform/detail/preprocessed/call.hpp>
5 #elif !defined(BOOST_PP_IS_ITERATING)
7 #define BOOST_PROTO_NTH_RESULT_TYPE(Z, M, DATA) \
9 typename when<_, BOOST_PP_CAT(A, M)>::template impl<Expr, State, Data> \
11 typedef typename BOOST_PP_CAT(a, M)::result_type BOOST_PP_CAT(b, M); \
14 #define BOOST_PROTO_NTH_RESULT(Z, M, DATA) \
15 detail::as_lvalue(BOOST_PP_CAT(a, M)()(e, s, d)) \
18 #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
19 #pragma wave option(preserve: 2, line: 0, output: "preprocessed/call.hpp")
22 ///////////////////////////////////////////////////////////////////////////////
24 /// Contains definition of the call<> transform.
26 // Copyright 2008 Eric Niebler. Distributed under the Boost
27 // Software License, Version 1.0. (See accompanying file
28 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
30 #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
31 #pragma wave option(preserve: 1)
34 #define BOOST_PP_ITERATION_PARAMS_1 \
35 (3, (1, BOOST_PROTO_MAX_ARITY, <boost/proto/transform/detail/call.hpp>))
36 #include BOOST_PP_ITERATE()
38 #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
39 #pragma wave option(output: null)
42 #undef BOOST_PROTO_NTH_RESULT
43 #undef BOOST_PROTO_NTH_RESULT_TYPE
47 #define N BOOST_PP_ITERATION()
50 /// \brief Call the PolymorphicFunctionObject \c Fun with the
51 /// current expression, state and data, transformed according
52 /// to \c A0 through \c AN.
53 template<typename Fun BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
54 struct call<Fun(BOOST_PP_ENUM_PARAMS(N, A))> : transform<call<Fun(BOOST_PP_ENUM_PARAMS(N, A))> >
56 template<typename Expr, typename State, typename Data>
57 struct impl : transform_impl<Expr, State, Data>
59 BOOST_PP_REPEAT(N, BOOST_PROTO_NTH_RESULT_TYPE, ~)
61 typedef detail::poly_function_traits<Fun, Fun(BOOST_PP_ENUM_PARAMS(N, b))> function_traits;
62 typedef typename function_traits::result_type result_type;
64 /// Let \c ax be <tt>when\<_, Ax\>()(e, s, d)</tt>
65 /// for each \c x in <tt>[0,N]</tt>.
66 /// Return <tt>Fun()(a0, a1,... aN)</tt>.
68 /// \param e The current expression
69 /// \param s The current state
70 /// \param d An arbitrary data
72 result_type operator ()(
73 typename impl::expr_param e
74 , typename impl::state_param s
75 , typename impl::data_param d
78 typedef typename function_traits::function_type function_type;
79 return function_type()(BOOST_PP_ENUM(N, BOOST_PROTO_NTH_RESULT, ~));
86 /// \brief Call the PolymorphicFunctionObject \c Fun with the
87 /// current expression, state and data, transformed according
88 /// to \c A0 through \c AN.
89 template<typename Fun BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
90 struct call<Fun(BOOST_PP_ENUM_PARAMS(N, A)...)> : transform<call<Fun(BOOST_PP_ENUM_PARAMS(N, A)...)> >
92 template<typename Expr, typename State, typename Data>
95 typename detail::expand_pattern<
96 proto::arity_of<Expr>::value // BUGBUG this isn't right. Could be pack(_child), should use arity of child!
97 , BOOST_PP_CAT(A, BOOST_PP_DEC(N))
98 , detail::BOOST_PP_CAT(expand_pattern_rest_, BOOST_PP_DEC(N))<
100 BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_DEC(N), A)
103 >::template impl<Expr, State, Data>