Chris@16
|
1 /*=============================================================================
|
Chris@16
|
2 Copyright (c) 2001-2007 Joel de Guzman
|
Chris@101
|
3 Copyright (c) 2014 John Fletcher
|
Chris@16
|
4
|
Chris@101
|
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
|
Chris@16
|
9 #if !BOOST_PHOENIX_IS_ITERATING
|
Chris@16
|
10
|
Chris@16
|
11 #ifndef PHOENIX_BIND_BIND_MEMBER_FUNCTION_HPP
|
Chris@16
|
12 #define PHOENIX_BIND_BIND_MEMBER_FUNCTION_HPP
|
Chris@16
|
13
|
Chris@101
|
14 #include <boost/utility/enable_if.hpp>
|
Chris@101
|
15 #include <boost/type_traits/is_member_function_pointer.hpp>
|
Chris@16
|
16 #include <boost/phoenix/core/expression.hpp>
|
Chris@16
|
17 #include <boost/phoenix/core/reference.hpp>
|
Chris@16
|
18 #include <boost/phoenix/core/detail/function_eval.hpp>
|
Chris@16
|
19 #include <boost/phoenix/bind/detail/member_function_ptr.hpp>
|
Chris@16
|
20
|
Chris@16
|
21 namespace boost { namespace phoenix
|
Chris@16
|
22 {
|
Chris@16
|
23
|
Chris@16
|
24 template <typename RT, typename ClassT, typename ClassA>
|
Chris@101
|
25 inline
|
Chris@101
|
26 typename boost::lazy_enable_if<
|
Chris@101
|
27 boost::is_member_function_pointer<RT (ClassT::*)()>,
|
Chris@101
|
28 typename detail::expression::function_eval<
|
Chris@16
|
29 detail::member_function_ptr<0, RT, RT(ClassT::*)()>
|
Chris@101
|
30 , ClassA >
|
Chris@16
|
31 >::type const
|
Chris@16
|
32 bind(RT(ClassT::*f)(), ClassA const& obj)
|
Chris@16
|
33 {
|
Chris@16
|
34 typedef detail::member_function_ptr<0, RT, RT(ClassT::*)()> fp_type;
|
Chris@16
|
35 return
|
Chris@16
|
36 detail::expression::function_eval<fp_type, ClassA>::make(
|
Chris@16
|
37 fp_type(f)
|
Chris@16
|
38 , obj
|
Chris@16
|
39 );
|
Chris@16
|
40 }
|
Chris@16
|
41
|
Chris@16
|
42 template <typename RT, typename ClassT, typename ClassA>
|
Chris@101
|
43 inline
|
Chris@101
|
44 typename boost::lazy_enable_if<
|
Chris@101
|
45 boost::is_member_function_pointer<RT (ClassT::*)()>,
|
Chris@101
|
46 typename detail::expression::function_eval<
|
Chris@16
|
47 detail::member_function_ptr<0, RT, RT(ClassT::*)() const>
|
Chris@101
|
48 , ClassA >
|
Chris@16
|
49 >::type const
|
Chris@16
|
50 bind(RT(ClassT::*f)() const, ClassA const& obj)
|
Chris@16
|
51 {
|
Chris@16
|
52 typedef
|
Chris@16
|
53 detail::member_function_ptr<0, RT, RT(ClassT::*)() const>
|
Chris@16
|
54 fp_type;
|
Chris@16
|
55 return
|
Chris@16
|
56 detail::expression::function_eval<fp_type, ClassA>::make(
|
Chris@16
|
57 fp_type(f)
|
Chris@16
|
58 , obj
|
Chris@16
|
59 );
|
Chris@16
|
60 }
|
Chris@16
|
61
|
Chris@16
|
62 template <typename RT, typename ClassT>
|
Chris@101
|
63 inline
|
Chris@101
|
64 typename detail::expression::function_eval<
|
Chris@16
|
65 detail::member_function_ptr<0, RT, RT(ClassT::*)()>
|
Chris@16
|
66 , ClassT
|
Chris@16
|
67 >::type const
|
Chris@16
|
68 bind(RT(ClassT::*f)(), ClassT& obj)
|
Chris@16
|
69 {
|
Chris@16
|
70 typedef detail::member_function_ptr<0, RT, RT(ClassT::*)()> fp_type;
|
Chris@16
|
71 return
|
Chris@16
|
72 detail::expression::function_eval<
|
Chris@16
|
73 fp_type
|
Chris@16
|
74 , ClassT
|
Chris@16
|
75 >::make(
|
Chris@16
|
76 fp_type(f)
|
Chris@16
|
77 , obj
|
Chris@16
|
78 );
|
Chris@16
|
79 }
|
Chris@16
|
80
|
Chris@16
|
81 template <typename RT, typename ClassT>
|
Chris@101
|
82 inline
|
Chris@101
|
83 typename detail::expression::function_eval<
|
Chris@16
|
84 detail::member_function_ptr<0, RT, RT(ClassT::*)() const>
|
Chris@16
|
85 , ClassT
|
Chris@16
|
86 >::type const
|
Chris@16
|
87 bind(RT(ClassT::*f)() const, ClassT& obj)
|
Chris@16
|
88 {
|
Chris@16
|
89 typedef detail::member_function_ptr<0, RT, RT(ClassT::*)() const> fp_type;
|
Chris@16
|
90 return
|
Chris@16
|
91 detail::expression::function_eval<
|
Chris@16
|
92 fp_type
|
Chris@16
|
93 , ClassT
|
Chris@16
|
94 >::make(
|
Chris@16
|
95 fp_type(f)
|
Chris@16
|
96 , obj
|
Chris@16
|
97 );
|
Chris@16
|
98 }
|
Chris@16
|
99
|
Chris@16
|
100 #if !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES)
|
Chris@16
|
101 #include <boost/phoenix/bind/preprocessed/bind_member_function.hpp>
|
Chris@16
|
102 #else
|
Chris@16
|
103
|
Chris@16
|
104 #if defined(__WAVE__) && defined (BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
|
Chris@16
|
105 #pragma wave option(preserve: 2, line: 0, output: "preprocessed/bind_member_function_" BOOST_PHOENIX_LIMIT_STR ".hpp")
|
Chris@16
|
106 #endif
|
Chris@16
|
107
|
Chris@16
|
108 /*=============================================================================
|
Chris@16
|
109 Copyright (c) 2001-2007 Joel de Guzman
|
Chris@16
|
110
|
Chris@16
|
111 Distributed under the Boost Software License, Version 1.0. (See accompanying
|
Chris@16
|
112 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
113 ==============================================================================*/
|
Chris@16
|
114
|
Chris@16
|
115 #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
|
Chris@16
|
116 #pragma wave option(preserve: 1)
|
Chris@16
|
117 #endif
|
Chris@16
|
118
|
Chris@16
|
119 #define BOOST_PHOENIX_ITERATION_PARAMS \
|
Chris@16
|
120 (3, (1, BOOST_PP_DEC(BOOST_PHOENIX_ACTOR_LIMIT), \
|
Chris@16
|
121 <boost/phoenix/bind/bind_member_function.hpp>))
|
Chris@16
|
122 #include BOOST_PHOENIX_ITERATE()
|
Chris@16
|
123
|
Chris@16
|
124 #if defined(__WAVE__) && defined (BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
|
Chris@16
|
125 #pragma wave option(output: null)
|
Chris@16
|
126 #endif
|
Chris@16
|
127
|
Chris@16
|
128 #endif
|
Chris@16
|
129
|
Chris@16
|
130 }}
|
Chris@16
|
131
|
Chris@16
|
132 #endif
|
Chris@16
|
133
|
Chris@16
|
134 #else
|
Chris@16
|
135
|
Chris@16
|
136 template <
|
Chris@16
|
137 typename RT
|
Chris@16
|
138 , typename ClassT
|
Chris@16
|
139 , BOOST_PP_ENUM_PARAMS(BOOST_PHOENIX_ITERATION, typename T)
|
Chris@16
|
140 , typename ClassA
|
Chris@16
|
141 , BOOST_PHOENIX_typename_A
|
Chris@16
|
142 >
|
Chris@16
|
143 inline
|
Chris@16
|
144 typename detail::expression::function_eval<
|
Chris@16
|
145 detail::member_function_ptr<
|
Chris@16
|
146 BOOST_PHOENIX_ITERATION
|
Chris@16
|
147 , RT
|
Chris@16
|
148 , RT(ClassT::*)(BOOST_PP_ENUM_PARAMS(BOOST_PHOENIX_ITERATION, T))
|
Chris@16
|
149 >
|
Chris@16
|
150 , ClassA
|
Chris@16
|
151 , BOOST_PHOENIX_A
|
Chris@16
|
152 >::type const
|
Chris@16
|
153 bind(
|
Chris@16
|
154 RT(ClassT::*f)(BOOST_PP_ENUM_PARAMS(BOOST_PHOENIX_ITERATION, T))
|
Chris@16
|
155 , ClassA const & obj
|
Chris@16
|
156 , BOOST_PHOENIX_A_const_ref_a
|
Chris@16
|
157 )
|
Chris@16
|
158 {
|
Chris@16
|
159 typedef detail::member_function_ptr<
|
Chris@16
|
160 BOOST_PHOENIX_ITERATION
|
Chris@16
|
161 , RT
|
Chris@16
|
162 , RT(ClassT::*)(BOOST_PP_ENUM_PARAMS(BOOST_PHOENIX_ITERATION, T))
|
Chris@16
|
163 > fp_type;
|
Chris@16
|
164 return
|
Chris@16
|
165 detail::expression::function_eval<
|
Chris@16
|
166 fp_type
|
Chris@16
|
167 , ClassA
|
Chris@16
|
168 , BOOST_PHOENIX_A
|
Chris@16
|
169 >::make(
|
Chris@16
|
170 fp_type(f)
|
Chris@16
|
171 , obj
|
Chris@16
|
172 , BOOST_PHOENIX_a
|
Chris@16
|
173 );
|
Chris@16
|
174 }
|
Chris@16
|
175
|
Chris@16
|
176 template <
|
Chris@16
|
177 typename RT
|
Chris@16
|
178 , typename ClassT
|
Chris@16
|
179 , BOOST_PP_ENUM_PARAMS(BOOST_PHOENIX_ITERATION, typename T)
|
Chris@16
|
180 , typename ClassA
|
Chris@16
|
181 , BOOST_PHOENIX_typename_A
|
Chris@16
|
182 >
|
Chris@16
|
183 inline
|
Chris@16
|
184 typename detail::expression::function_eval<
|
Chris@16
|
185 detail::member_function_ptr<
|
Chris@16
|
186 BOOST_PHOENIX_ITERATION
|
Chris@16
|
187 , RT
|
Chris@16
|
188 , RT(ClassT::*)(BOOST_PP_ENUM_PARAMS(BOOST_PHOENIX_ITERATION, T)) const
|
Chris@16
|
189 >
|
Chris@16
|
190 , ClassA
|
Chris@16
|
191 , BOOST_PHOENIX_A
|
Chris@16
|
192 >::type const
|
Chris@16
|
193 bind(
|
Chris@16
|
194 RT(ClassT::*f)(BOOST_PP_ENUM_PARAMS(BOOST_PHOENIX_ITERATION, T)) const
|
Chris@16
|
195 , ClassA const & obj
|
Chris@16
|
196 , BOOST_PHOENIX_A_const_ref_a
|
Chris@16
|
197 )
|
Chris@16
|
198 {
|
Chris@16
|
199 typedef detail::member_function_ptr<
|
Chris@16
|
200 BOOST_PHOENIX_ITERATION
|
Chris@16
|
201 , RT
|
Chris@16
|
202 , RT(ClassT::*)(BOOST_PP_ENUM_PARAMS(BOOST_PHOENIX_ITERATION, T)) const
|
Chris@16
|
203 > fp_type;
|
Chris@16
|
204 return
|
Chris@16
|
205 detail::expression::function_eval<
|
Chris@16
|
206 fp_type
|
Chris@16
|
207 , ClassA
|
Chris@16
|
208 , BOOST_PHOENIX_A
|
Chris@16
|
209 >::make(
|
Chris@16
|
210 fp_type(f)
|
Chris@16
|
211 , obj
|
Chris@16
|
212 , BOOST_PHOENIX_a
|
Chris@16
|
213 );
|
Chris@16
|
214 }
|
Chris@16
|
215
|
Chris@16
|
216 template <
|
Chris@16
|
217 typename RT
|
Chris@16
|
218 , typename ClassT
|
Chris@16
|
219 , BOOST_PP_ENUM_PARAMS(BOOST_PHOENIX_ITERATION, typename T)
|
Chris@16
|
220 , BOOST_PHOENIX_typename_A
|
Chris@16
|
221 >
|
Chris@16
|
222 inline
|
Chris@16
|
223 typename detail::expression::function_eval<
|
Chris@16
|
224 detail::member_function_ptr<
|
Chris@16
|
225 BOOST_PHOENIX_ITERATION
|
Chris@16
|
226 , RT
|
Chris@16
|
227 , RT(ClassT::*)(BOOST_PP_ENUM_PARAMS(BOOST_PHOENIX_ITERATION, T))
|
Chris@16
|
228 >
|
Chris@16
|
229 , ClassT
|
Chris@16
|
230 , BOOST_PHOENIX_A
|
Chris@16
|
231 >::type const
|
Chris@16
|
232 bind(
|
Chris@16
|
233 RT(ClassT::*f)(BOOST_PP_ENUM_PARAMS(BOOST_PHOENIX_ITERATION, T))
|
Chris@16
|
234 , ClassT & obj
|
Chris@16
|
235 , BOOST_PHOENIX_A_const_ref_a
|
Chris@16
|
236 )
|
Chris@16
|
237 {
|
Chris@16
|
238 typedef detail::member_function_ptr<
|
Chris@16
|
239 BOOST_PHOENIX_ITERATION
|
Chris@16
|
240 , RT
|
Chris@16
|
241 , RT(ClassT::*)(BOOST_PP_ENUM_PARAMS(BOOST_PHOENIX_ITERATION, T))
|
Chris@16
|
242 > fp_type;
|
Chris@16
|
243 return
|
Chris@16
|
244 detail::expression::function_eval<
|
Chris@16
|
245 fp_type
|
Chris@16
|
246 , ClassT
|
Chris@16
|
247 , BOOST_PHOENIX_A
|
Chris@16
|
248 >::make(
|
Chris@16
|
249 fp_type(f)
|
Chris@16
|
250 , obj
|
Chris@16
|
251 , BOOST_PHOENIX_a
|
Chris@16
|
252 );
|
Chris@16
|
253 }
|
Chris@16
|
254
|
Chris@16
|
255 #endif
|
Chris@16
|
256
|