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
|
Chris@16
|
8 #if !BOOST_PHOENIX_IS_ITERATING
|
Chris@16
|
9
|
Chris@16
|
10 #ifndef PHOENIX_BIND_BIND_FUNCTION_HPP
|
Chris@16
|
11 #define PHOENIX_BIND_BIND_FUNCTION_HPP
|
Chris@16
|
12
|
Chris@16
|
13 #include <boost/phoenix/core/expression.hpp>
|
Chris@16
|
14 #include <boost/phoenix/core/detail/function_eval.hpp>
|
Chris@16
|
15 #include <boost/phoenix/bind/detail/function_ptr.hpp>
|
Chris@16
|
16
|
Chris@16
|
17 namespace boost { namespace phoenix {
|
Chris@16
|
18
|
Chris@16
|
19 template <
|
Chris@16
|
20 typename RT
|
Chris@16
|
21 >
|
Chris@16
|
22 inline
|
Chris@16
|
23 typename detail::expression::function_eval<
|
Chris@16
|
24 detail::function_ptr<0, RT, RT(*)()>
|
Chris@16
|
25 >::type const
|
Chris@16
|
26 bind(RT(*f)())
|
Chris@16
|
27 {
|
Chris@16
|
28 typedef detail::function_ptr<0, RT, RT(*)()> fp_type;
|
Chris@16
|
29 return detail::expression::function_eval<fp_type>::make(fp_type(f));
|
Chris@16
|
30 }
|
Chris@16
|
31
|
Chris@16
|
32 template <
|
Chris@16
|
33 typename RT
|
Chris@16
|
34 , typename T0
|
Chris@16
|
35 , typename A0
|
Chris@16
|
36 >
|
Chris@16
|
37 inline
|
Chris@16
|
38 typename detail::expression::function_eval<
|
Chris@16
|
39 detail::function_ptr<1, RT, RT(*)(T0)>
|
Chris@16
|
40 , A0
|
Chris@16
|
41 >::type const
|
Chris@16
|
42 bind(RT(*f)(T0), A0 const & a0)
|
Chris@16
|
43 {
|
Chris@16
|
44 typedef detail::function_ptr<1, RT, RT(*)(T0)> fp_type;
|
Chris@16
|
45 return detail::expression::function_eval<fp_type, A0>::make(fp_type(f), a0);
|
Chris@16
|
46 }
|
Chris@16
|
47
|
Chris@16
|
48 #if !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES)
|
Chris@16
|
49 #include <boost/phoenix/bind/preprocessed/bind_function.hpp>
|
Chris@16
|
50 #else
|
Chris@16
|
51
|
Chris@16
|
52 #if defined(__WAVE__) && defined (BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
|
Chris@16
|
53 #pragma wave option(preserve: 2, line: 0, output: "preprocessed/bind_function_" BOOST_PHOENIX_LIMIT_STR ".hpp")
|
Chris@16
|
54 #endif
|
Chris@16
|
55
|
Chris@16
|
56 /*=============================================================================
|
Chris@16
|
57 Copyright (c) 2001-2007 Joel de Guzman
|
Chris@16
|
58
|
Chris@16
|
59 Distributed under the Boost Software License, Version 1.0. (See accompanying
|
Chris@16
|
60 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
61 ==============================================================================*/
|
Chris@16
|
62
|
Chris@16
|
63 #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
|
Chris@16
|
64 #pragma wave option(preserve: 1)
|
Chris@16
|
65 #endif
|
Chris@16
|
66
|
Chris@16
|
67 #define BOOST_PHOENIX_ITERATION_PARAMS \
|
Chris@16
|
68 (3, (2, BOOST_PP_DEC(BOOST_PHOENIX_ACTOR_LIMIT), \
|
Chris@16
|
69 <boost/phoenix/bind/bind_function.hpp>))
|
Chris@16
|
70 #include BOOST_PHOENIX_ITERATE()
|
Chris@16
|
71
|
Chris@16
|
72 #if defined(__WAVE__) && defined (BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
|
Chris@16
|
73 #pragma wave option(output: null)
|
Chris@16
|
74 #endif
|
Chris@16
|
75
|
Chris@16
|
76 #endif
|
Chris@16
|
77
|
Chris@16
|
78 }}
|
Chris@16
|
79
|
Chris@16
|
80 #endif
|
Chris@16
|
81
|
Chris@16
|
82 #else
|
Chris@16
|
83
|
Chris@16
|
84 template <
|
Chris@16
|
85 typename RT
|
Chris@16
|
86 , BOOST_PP_ENUM_PARAMS(BOOST_PHOENIX_ITERATION, typename T)
|
Chris@16
|
87 , BOOST_PHOENIX_typename_A
|
Chris@16
|
88 >
|
Chris@16
|
89 inline
|
Chris@16
|
90 typename detail::expression::function_eval<
|
Chris@16
|
91 detail::function_ptr<
|
Chris@16
|
92 BOOST_PHOENIX_ITERATION
|
Chris@16
|
93 , RT
|
Chris@16
|
94 , RT(*)(BOOST_PP_ENUM_PARAMS(BOOST_PHOENIX_ITERATION, T))
|
Chris@16
|
95 >
|
Chris@16
|
96 , BOOST_PHOENIX_A
|
Chris@16
|
97 >::type const
|
Chris@16
|
98 bind(
|
Chris@16
|
99 RT(*f)(BOOST_PP_ENUM_PARAMS(BOOST_PHOENIX_ITERATION, T))
|
Chris@16
|
100 , BOOST_PHOENIX_A_const_ref_a
|
Chris@16
|
101 )
|
Chris@16
|
102 {
|
Chris@16
|
103 typedef detail::function_ptr<
|
Chris@16
|
104 BOOST_PHOENIX_ITERATION
|
Chris@16
|
105 , RT
|
Chris@16
|
106 , RT(*)(BOOST_PP_ENUM_PARAMS(BOOST_PHOENIX_ITERATION, T))
|
Chris@16
|
107 > fp_type;
|
Chris@16
|
108 return
|
Chris@16
|
109 detail::expression::function_eval<
|
Chris@16
|
110 fp_type
|
Chris@16
|
111 , BOOST_PHOENIX_A
|
Chris@16
|
112 >::make(
|
Chris@16
|
113 fp_type(f)
|
Chris@16
|
114 , BOOST_PHOENIX_a
|
Chris@16
|
115 );
|
Chris@16
|
116 }
|
Chris@16
|
117
|
Chris@16
|
118 #endif
|