Chris@16
|
1 /*==============================================================================
|
Chris@16
|
2 Copyright (c) 2005-2010 Joel de Guzman
|
Chris@16
|
3 Copyright (c) 2011 Thomas Heller
|
Chris@16
|
4
|
Chris@16
|
5 Distributed under the Boost Software License, Version 1.0. (See accompanying
|
Chris@16
|
6 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
7 ==============================================================================*/
|
Chris@16
|
8 #ifndef BOOST_PHOENIX_CORE_CALL_HPP
|
Chris@16
|
9 #define BOOST_PHOENIX_CORE_CALL_HPP
|
Chris@16
|
10
|
Chris@16
|
11 #include <boost/phoenix/core/limits.hpp>
|
Chris@16
|
12 #include <boost/phoenix/core/environment.hpp>
|
Chris@16
|
13 #include <boost/proto/proto_fwd.hpp>
|
Chris@16
|
14 #include <boost/proto/traits.hpp>
|
Chris@16
|
15 #include <boost/proto/transform/impl.hpp>
|
Chris@16
|
16
|
Chris@16
|
17 namespace boost { namespace phoenix
|
Chris@16
|
18 {
|
Chris@16
|
19 namespace detail
|
Chris@16
|
20 {
|
Chris@16
|
21 template <
|
Chris@16
|
22 typename Fun
|
Chris@16
|
23 , typename Expr
|
Chris@16
|
24 , typename State
|
Chris@16
|
25 , typename Data
|
Chris@16
|
26 , long Arity = proto::arity_of<Expr>::value
|
Chris@16
|
27 >
|
Chris@16
|
28 struct call_impl;
|
Chris@16
|
29
|
Chris@16
|
30 template <typename Fun, typename Expr, typename State, typename Data>
|
Chris@16
|
31 struct call_impl<Fun, Expr, State, Data, 0>
|
Chris@16
|
32 : proto::transform_impl<Expr, State, Data>
|
Chris@16
|
33 {
|
Chris@16
|
34 typedef
|
Chris@16
|
35 typename boost::phoenix::result_of::context<State, Data>::type
|
Chris@16
|
36 context_type;
|
Chris@16
|
37
|
Chris@16
|
38 typedef
|
Chris@16
|
39 typename boost::result_of<
|
Chris@16
|
40 Fun(Expr, context_type)
|
Chris@16
|
41 >::type
|
Chris@16
|
42 result_type;
|
Chris@16
|
43
|
Chris@16
|
44 result_type operator()(
|
Chris@16
|
45 typename call_impl::expr_param e
|
Chris@16
|
46 , typename call_impl::state_param s
|
Chris@16
|
47 , typename call_impl::data_param d
|
Chris@16
|
48 ) const
|
Chris@16
|
49 {
|
Chris@16
|
50 return Fun()(e, boost::phoenix::context(s, d));
|
Chris@16
|
51 }
|
Chris@16
|
52 };
|
Chris@16
|
53 }
|
Chris@16
|
54
|
Chris@16
|
55 template <typename Fun, typename Dummy = void>
|
Chris@16
|
56 struct call
|
Chris@16
|
57 : proto::transform<call<Fun> >
|
Chris@16
|
58 {
|
Chris@16
|
59 template <typename Expr, typename State, typename Data>
|
Chris@16
|
60 struct impl
|
Chris@16
|
61 : detail::call_impl<Fun, Expr, State, Data>
|
Chris@16
|
62 {};
|
Chris@16
|
63 };
|
Chris@16
|
64
|
Chris@16
|
65 #include <boost/phoenix/core/detail/call.hpp>
|
Chris@16
|
66
|
Chris@16
|
67 }
|
Chris@16
|
68 namespace proto
|
Chris@16
|
69 {
|
Chris@16
|
70 template <typename Fun, typename Dummy>
|
Chris@16
|
71 struct is_callable<phoenix::call<Fun, Dummy> > : mpl::true_ {};
|
Chris@16
|
72 }
|
Chris@16
|
73 }
|
Chris@16
|
74
|
Chris@16
|
75 #endif
|