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_BIND_BIND_FUNCTION_HPP
|
Chris@16
|
8 #define PHOENIX_BIND_BIND_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 #include <boost/spirit/home/phoenix/bind/detail/function_ptr.hpp>
|
Chris@16
|
13
|
Chris@16
|
14 namespace boost { namespace phoenix
|
Chris@16
|
15 {
|
Chris@16
|
16 template <typename RT>
|
Chris@16
|
17 inline actor<
|
Chris@16
|
18 typename as_composite<
|
Chris@16
|
19 detail::function_eval<0>
|
Chris@16
|
20 , detail::function_ptr<0, RT, RT(*)()>
|
Chris@16
|
21 >::type>
|
Chris@16
|
22 bind(RT(*f)())
|
Chris@16
|
23 {
|
Chris@16
|
24 typedef detail::function_ptr<0, RT, RT(*)()> fp_type;
|
Chris@16
|
25 return compose<detail::function_eval<0> >(fp_type(f));
|
Chris@16
|
26 }
|
Chris@16
|
27
|
Chris@16
|
28 template <typename RT, typename T0, typename A0>
|
Chris@16
|
29 inline actor<
|
Chris@16
|
30 typename as_composite<
|
Chris@16
|
31 detail::function_eval<1>
|
Chris@16
|
32 , detail::function_ptr<1, RT, RT(*)(T0)>
|
Chris@16
|
33 , A0
|
Chris@16
|
34 >::type>
|
Chris@16
|
35 bind(RT(*f)(T0), A0 const& _0)
|
Chris@16
|
36 {
|
Chris@16
|
37 typedef detail::function_ptr<1, RT, RT(*)(T0)> fp_type;
|
Chris@16
|
38 return compose<detail::function_eval<1> >(fp_type(f), _0);
|
Chris@16
|
39 }
|
Chris@16
|
40
|
Chris@16
|
41 template <typename RT, typename T0, typename T1, typename A0, typename A1>
|
Chris@16
|
42 inline actor<
|
Chris@16
|
43 typename as_composite<
|
Chris@16
|
44 detail::function_eval<2>
|
Chris@16
|
45 , detail::function_ptr<2, RT, RT(*)(T0, T1)>
|
Chris@16
|
46 , A0, A1
|
Chris@16
|
47 >::type>
|
Chris@16
|
48 bind(RT(*f)(T0, T1), A0 const& _0, A1 const& _1)
|
Chris@16
|
49 {
|
Chris@16
|
50 typedef detail::function_ptr<2, RT, RT(*)(T0, T1)> fp_type;
|
Chris@16
|
51 return compose<detail::function_eval<2> >(fp_type(f), _0, _1);
|
Chris@16
|
52 }
|
Chris@16
|
53
|
Chris@16
|
54 // Bring in the rest of the function binders
|
Chris@16
|
55 #include <boost/spirit/home/phoenix/bind/detail/bind_function.hpp>
|
Chris@16
|
56 }}
|
Chris@16
|
57
|
Chris@16
|
58 #endif
|