Chris@16
|
1 /*==============================================================================
|
Chris@16
|
2 Copyright (c) 2001-2010 Joel de Guzman
|
Chris@16
|
3 Copyright (c) 2010 Eric Niebler
|
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_FUNCTION_FUNCTION_HPP
|
Chris@16
|
9 #define BOOST_PHOENIX_FUNCTION_FUNCTION_HPP
|
Chris@16
|
10
|
Chris@101
|
11 #include <boost/phoenix/config.hpp>
|
Chris@16
|
12 //#include <boost/phoenix/function/function_handling.hpp>
|
Chris@16
|
13 #include <boost/phoenix/core/detail/function_eval.hpp>
|
Chris@16
|
14 #include <boost/preprocessor/facilities/expand.hpp>
|
Chris@16
|
15 #include <boost/preprocessor/logical/or.hpp>
|
Chris@16
|
16 #include <boost/utility/result_of.hpp>
|
Chris@16
|
17
|
Chris@16
|
18 namespace boost { namespace phoenix
|
Chris@16
|
19 {
|
Chris@16
|
20 /////////////////////////////////////////////////////////////////////////////
|
Chris@16
|
21 // Functions
|
Chris@16
|
22 /////////////////////////////////////////////////////////////////////////////
|
Chris@101
|
23
|
Chris@101
|
24 namespace expression
|
Chris@101
|
25 {
|
Chris@101
|
26 template <typename F, BOOST_PHOENIX_typename_A_void(BOOST_PHOENIX_ACTOR_LIMIT)>
|
Chris@101
|
27 struct function
|
Chris@101
|
28 : detail::expression::function_eval<F, BOOST_PHOENIX_A(BOOST_PHOENIX_ACTOR_LIMIT)>
|
Chris@101
|
29 {};
|
Chris@101
|
30 }
|
Chris@16
|
31
|
Chris@16
|
32 // functor which returns our lazy function call extension
|
Chris@16
|
33 template<typename F>
|
Chris@16
|
34 struct function
|
Chris@16
|
35 {
|
Chris@16
|
36 BOOST_CONSTEXPR function()
|
Chris@16
|
37 : f()
|
Chris@16
|
38 {}
|
Chris@16
|
39
|
Chris@101
|
40 BOOST_CONSTEXPR function(F f_)
|
Chris@101
|
41 : f(f_)
|
Chris@16
|
42 {}
|
Chris@16
|
43
|
Chris@16
|
44 template <typename Sig>
|
Chris@16
|
45 struct result;
|
Chris@16
|
46
|
Chris@16
|
47 typename detail::expression::function_eval<F>::type const
|
Chris@16
|
48 operator()() const
|
Chris@16
|
49 {
|
Chris@16
|
50 return detail::expression::function_eval<F>::make(f);
|
Chris@16
|
51 }
|
Chris@16
|
52
|
Chris@16
|
53 // Bring in the rest
|
Chris@16
|
54 #include <boost/phoenix/function/detail/function_operator.hpp>
|
Chris@16
|
55
|
Chris@16
|
56 F f;
|
Chris@16
|
57 };
|
Chris@16
|
58 }
|
Chris@16
|
59
|
Chris@16
|
60 template<typename F>
|
Chris@16
|
61 struct result_of<phoenix::function<F>()>
|
Chris@16
|
62 : phoenix::detail::expression::function_eval<F>
|
Chris@16
|
63 {};
|
Chris@16
|
64
|
Chris@16
|
65 }
|
Chris@16
|
66
|
Chris@16
|
67 #endif
|
Chris@16
|
68
|