Chris@16
|
1 /*=============================================================================
|
Chris@16
|
2 Copyright (c) 2001-2007 Joel de Guzman
|
Chris@16
|
3
|
Chris@16
|
4 Distributed under the Boost Software License, Version 1.0. (See accompanying
|
Chris@16
|
5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
6 ==============================================================================*/
|
Chris@16
|
7 #ifndef PHOENIX_FUNCTION_FUNCTION_HPP
|
Chris@16
|
8 #define PHOENIX_FUNCTION_FUNCTION_HPP
|
Chris@16
|
9
|
Chris@16
|
10 #include <boost/spirit/home/phoenix/core/compose.hpp>
|
Chris@16
|
11 #include <boost/spirit/home/phoenix/core/detail/function_eval.hpp>
|
Chris@16
|
12
|
Chris@16
|
13 namespace boost { namespace phoenix
|
Chris@16
|
14 {
|
Chris@16
|
15 template <typename F>
|
Chris@16
|
16 struct function
|
Chris@16
|
17 {
|
Chris@16
|
18 function() : f() {}
|
Chris@16
|
19 function(F const& f_) : f(f_) {}
|
Chris@16
|
20
|
Chris@16
|
21 actor<typename as_composite<detail::function_eval<0>, F>::type>
|
Chris@16
|
22 operator()() const
|
Chris@16
|
23 {
|
Chris@16
|
24 return compose<detail::function_eval<0> >(f);
|
Chris@16
|
25 }
|
Chris@16
|
26
|
Chris@16
|
27 template <typename A0>
|
Chris@16
|
28 actor<typename as_composite<detail::function_eval<1>, F, A0>::type>
|
Chris@16
|
29 operator()(A0 const& _0) const
|
Chris@16
|
30 {
|
Chris@16
|
31 return compose<detail::function_eval<1> >(f, _0);
|
Chris@16
|
32 }
|
Chris@16
|
33
|
Chris@16
|
34 template <typename A0, typename A1>
|
Chris@16
|
35 actor<typename as_composite<detail::function_eval<2>, F, A0, A1>::type>
|
Chris@16
|
36 operator()(A0 const& _0, A1 const& _1) const
|
Chris@16
|
37 {
|
Chris@16
|
38 return compose<detail::function_eval<2> >(f, _0, _1);
|
Chris@16
|
39 }
|
Chris@16
|
40
|
Chris@16
|
41 // Bring in the rest of the function call operators
|
Chris@16
|
42 #include <boost/spirit/home/phoenix/function/detail/function_call.hpp>
|
Chris@16
|
43
|
Chris@16
|
44 F f;
|
Chris@16
|
45 };
|
Chris@16
|
46 }}
|
Chris@16
|
47
|
Chris@16
|
48 #endif
|