1 |
1 #ifndef BOOST_BIND_HPP_INCLUDED |
2 #if !defined(BOOST_PP_IS_ITERATING) |
2 #define BOOST_BIND_HPP_INCLUDED |
3 |
3 |
4 ///// header body |
4 // MS compatible compilers support #pragma once |
5 |
5 |
6 #ifndef BOOST_MPL_BIND_HPP_INCLUDED |
6 #if defined(_MSC_VER) && (_MSC_VER >= 1020) |
7 #define BOOST_MPL_BIND_HPP_INCLUDED |
7 # pragma once |
8 |
8 #endif |
9 // Copyright Peter Dimov 2001 |
9 |
10 // Copyright Aleksey Gurtovoy 2001-2004 |
|
11 // |
10 // |
12 // Distributed under the Boost Software License, Version 1.0. |
11 // bind.hpp - binds function objects to arguments |
13 // (See accompanying file LICENSE_1_0.txt or copy at |
12 // |
|
13 // Copyright (c) 2001-2004 Peter Dimov and Multi Media Ltd. |
|
14 // Copyright (c) 2001 David Abrahams |
|
15 // Copyright (c) 2005 Peter Dimov |
|
16 // |
|
17 // Distributed under the Boost Software License, Version 1.0. (See |
|
18 // accompanying file LICENSE_1_0.txt or copy at |
14 // http://www.boost.org/LICENSE_1_0.txt) |
19 // http://www.boost.org/LICENSE_1_0.txt) |
15 // |
20 // |
16 // See http://www.boost.org/libs/mpl for documentation. |
21 // See http://www.boost.org/libs/bind/bind.html for documentation. |
17 |
22 // |
18 // $Source: /cvsroot/boost/boost/boost/mpl/bind.hpp,v $ |
23 |
19 // $Date: 2004/10/26 14:51:04 $ |
24 #include <boost/config.hpp> |
20 // $Revision: 1.13 $ |
25 #include <boost/ref.hpp> |
21 |
26 #include <boost/mem_fn.hpp> |
22 #if !defined(BOOST_MPL_PREPROCESSING_MODE) |
27 #include <boost/type.hpp> |
23 # include <boost/mpl/bind_fwd.hpp> |
28 #include <boost/bind/arg.hpp> |
24 # include <boost/mpl/placeholders.hpp> |
29 #include <boost/detail/workaround.hpp> |
25 # include <boost/mpl/next.hpp> |
30 #include <boost/visit_each.hpp> |
26 # include <boost/mpl/protect.hpp> |
31 |
27 # include <boost/mpl/apply_wrap.hpp> |
32 // Borland-specific bug, visit_each() silently fails to produce code |
28 # include <boost/mpl/limits/arity.hpp> |
33 |
29 # include <boost/mpl/aux_/na.hpp> |
34 #if defined(__BORLANDC__) |
30 # include <boost/mpl/aux_/arity_spec.hpp> |
35 # define BOOST_BIND_VISIT_EACH boost::visit_each |
31 # include <boost/mpl/aux_/type_wrapper.hpp> |
|
32 # include <boost/mpl/aux_/yes_no.hpp> |
|
33 # if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) |
|
34 # include <boost/type_traits/is_reference.hpp> |
|
35 # endif |
|
36 #endif |
|
37 |
|
38 #include <boost/mpl/aux_/config/bind.hpp> |
|
39 #include <boost/mpl/aux_/config/static_constant.hpp> |
|
40 #include <boost/mpl/aux_/config/use_preprocessed.hpp> |
|
41 |
|
42 #if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \ |
|
43 && !defined(BOOST_MPL_PREPROCESSING_MODE) |
|
44 |
|
45 # if defined(BOOST_MPL_CFG_NO_UNNAMED_PLACEHOLDER_SUPPORT) |
|
46 # define BOOST_MPL_PREPROCESSED_HEADER basic_bind.hpp |
|
47 # else |
|
48 # define BOOST_MPL_PREPROCESSED_HEADER bind.hpp |
|
49 # endif |
|
50 # include <boost/mpl/aux_/include_preprocessed.hpp> |
|
51 |
|
52 #else |
36 #else |
53 |
37 # define BOOST_BIND_VISIT_EACH visit_each |
54 # include <boost/mpl/aux_/preprocessor/params.hpp> |
38 #endif |
55 # include <boost/mpl/aux_/preprocessor/default_params.hpp> |
39 |
56 # include <boost/mpl/aux_/preprocessor/def_params_tail.hpp> |
40 #include <boost/bind/storage.hpp> |
57 # include <boost/mpl/aux_/preprocessor/partial_spec_params.hpp> |
41 |
58 # include <boost/mpl/aux_/preprocessor/ext_params.hpp> |
42 #ifdef BOOST_MSVC |
59 # include <boost/mpl/aux_/preprocessor/repeat.hpp> |
43 # pragma warning(push) |
60 # include <boost/mpl/aux_/preprocessor/enum.hpp> |
44 # pragma warning(disable: 4512) // assignment operator could not be generated |
61 # include <boost/mpl/aux_/preprocessor/add.hpp> |
45 #endif |
62 # include <boost/mpl/aux_/config/dmc_ambiguous_ctps.hpp> |
46 |
63 # include <boost/mpl/aux_/config/ctps.hpp> |
47 namespace boost |
64 # include <boost/mpl/aux_/config/ttp.hpp> |
48 { |
65 # include <boost/mpl/aux_/config/dtp.hpp> |
49 |
66 # include <boost/mpl/aux_/nttp_decl.hpp> |
50 namespace _bi // implementation details |
67 |
51 { |
68 # include <boost/preprocessor/iterate.hpp> |
52 |
69 # include <boost/preprocessor/comma_if.hpp> |
53 // result_traits |
70 # include <boost/preprocessor/cat.hpp> |
54 |
71 # include <boost/preprocessor/inc.hpp> |
55 template<class R, class F> struct result_traits |
72 |
56 { |
73 namespace boost { namespace mpl { |
57 typedef R type; |
74 |
58 }; |
75 // local macros, #undef-ined at the end of the header |
59 |
76 # define AUX778076_APPLY \ |
60 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) |
77 BOOST_PP_CAT(apply_wrap,BOOST_MPL_LIMIT_METAFUNCTION_ARITY) \ |
61 |
78 /**/ |
62 struct unspecified {}; |
79 |
63 |
80 # if defined(BOOST_MPL_CFG_DMC_AMBIGUOUS_CTPS) |
64 template<class F> struct result_traits<unspecified, F> |
81 # define AUX778076_DMC_PARAM() , int dummy_ |
65 { |
82 # else |
66 typedef typename F::result_type type; |
83 # define AUX778076_DMC_PARAM() |
67 }; |
84 # endif |
68 |
85 |
69 template<class F> struct result_traits< unspecified, reference_wrapper<F> > |
86 # define AUX778076_BIND_PARAMS(param) \ |
70 { |
87 BOOST_MPL_PP_PARAMS( \ |
71 typedef typename F::result_type type; |
88 BOOST_MPL_LIMIT_METAFUNCTION_ARITY \ |
72 }; |
89 , param \ |
73 |
90 ) \ |
74 #endif |
91 /**/ |
75 |
92 |
76 // ref_compare |
93 # define AUX778076_BIND_DEFAULT_PARAMS(param, value) \ |
77 |
94 BOOST_MPL_PP_DEFAULT_PARAMS( \ |
78 template<class T> bool ref_compare( T const & a, T const & b, long ) |
95 BOOST_MPL_LIMIT_METAFUNCTION_ARITY \ |
79 { |
96 , param \ |
80 return a == b; |
97 , value \ |
81 } |
98 ) \ |
82 |
99 /**/ |
83 template<int I> bool ref_compare( arg<I> const &, arg<I> const &, int ) |
100 |
84 { |
101 # define AUX778076_BIND_N_PARAMS(n, param) \ |
85 return true; |
102 BOOST_PP_COMMA_IF(n) BOOST_MPL_PP_PARAMS(n, param) \ |
86 } |
103 /**/ |
87 |
104 |
88 template<int I> bool ref_compare( arg<I> (*) (), arg<I> (*) (), int ) |
105 # define AUX778076_BIND_N_SPEC_PARAMS(n, param, def) \ |
89 { |
106 BOOST_PP_COMMA_IF(n) \ |
90 return true; |
107 BOOST_MPL_PP_PARTIAL_SPEC_PARAMS(n, param, def) \ |
91 } |
108 /**/ |
92 |
109 |
93 template<class T> bool ref_compare( reference_wrapper<T> const & a, reference_wrapper<T> const & b, int ) |
110 #if !defined(BOOST_MPL_CFG_NO_DEFAULT_PARAMETERS_IN_NESTED_TEMPLATES) |
94 { |
111 # define AUX778076_BIND_NESTED_DEFAULT_PARAMS(param, value) \ |
95 return a.get_pointer() == b.get_pointer(); |
112 AUX778076_BIND_DEFAULT_PARAMS(param, value) \ |
96 } |
113 /**/ |
97 |
|
98 // bind_t forward declaration for listN |
|
99 |
|
100 template<class R, class F, class L> class bind_t; |
|
101 |
|
102 // value |
|
103 |
|
104 template<class T> class value |
|
105 { |
|
106 public: |
|
107 |
|
108 value(T const & t): t_(t) {} |
|
109 |
|
110 T & get() { return t_; } |
|
111 T const & get() const { return t_; } |
|
112 |
|
113 bool operator==(value const & rhs) const |
|
114 { |
|
115 return t_ == rhs.t_; |
|
116 } |
|
117 |
|
118 private: |
|
119 |
|
120 T t_; |
|
121 }; |
|
122 |
|
123 // type |
|
124 |
|
125 template<class T> class type {}; |
|
126 |
|
127 // unwrap |
|
128 |
|
129 template<class F> struct unwrapper |
|
130 { |
|
131 static inline F & unwrap( F & f, long ) |
|
132 { |
|
133 return f; |
|
134 } |
|
135 |
|
136 template<class F2> static inline F2 & unwrap( reference_wrapper<F2> rf, int ) |
|
137 { |
|
138 return rf.get(); |
|
139 } |
|
140 |
|
141 template<class R, class T> static inline _mfi::dm<R, T> unwrap( R T::* pm, int ) |
|
142 { |
|
143 return _mfi::dm<R, T>( pm ); |
|
144 } |
|
145 }; |
|
146 |
|
147 // listN |
|
148 |
|
149 class list0 |
|
150 { |
|
151 public: |
|
152 |
|
153 list0() {} |
|
154 |
|
155 template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); } |
|
156 |
|
157 template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); } |
|
158 |
|
159 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); } |
|
160 |
|
161 template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const { return b.eval(*this); } |
|
162 |
|
163 template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); } |
|
164 |
|
165 template<class R, class F, class A> R operator()(type<R>, F & f, A &, long) |
|
166 { |
|
167 return unwrapper<F>::unwrap(f, 0)(); |
|
168 } |
|
169 |
|
170 template<class R, class F, class A> R operator()(type<R>, F const & f, A &, long) const |
|
171 { |
|
172 return unwrapper<F const>::unwrap(f, 0)(); |
|
173 } |
|
174 |
|
175 template<class F, class A> void operator()(type<void>, F & f, A &, int) |
|
176 { |
|
177 unwrapper<F>::unwrap(f, 0)(); |
|
178 } |
|
179 |
|
180 template<class F, class A> void operator()(type<void>, F const & f, A &, int) const |
|
181 { |
|
182 unwrapper<F const>::unwrap(f, 0)(); |
|
183 } |
|
184 |
|
185 template<class V> void accept(V &) const |
|
186 { |
|
187 } |
|
188 |
|
189 bool operator==(list0 const &) const |
|
190 { |
|
191 return true; |
|
192 } |
|
193 }; |
|
194 |
|
195 template< class A1 > class list1: private storage1< A1 > |
|
196 { |
|
197 private: |
|
198 |
|
199 typedef storage1< A1 > base_type; |
|
200 |
|
201 public: |
|
202 |
|
203 explicit list1( A1 a1 ): base_type( a1 ) {} |
|
204 |
|
205 A1 operator[] (boost::arg<1>) const { return base_type::a1_; } |
|
206 |
|
207 A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } |
|
208 |
|
209 template<class T> T & operator[] ( _bi::value<T> & v ) const { return v.get(); } |
|
210 |
|
211 template<class T> T const & operator[] ( _bi::value<T> const & v ) const { return v.get(); } |
|
212 |
|
213 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); } |
|
214 |
|
215 template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const { return b.eval(*this); } |
|
216 |
|
217 template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); } |
|
218 |
|
219 template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long) |
|
220 { |
|
221 return unwrapper<F>::unwrap(f, 0)(a[base_type::a1_]); |
|
222 } |
|
223 |
|
224 template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const |
|
225 { |
|
226 return unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_]); |
|
227 } |
|
228 |
|
229 template<class F, class A> void operator()(type<void>, F & f, A & a, int) |
|
230 { |
|
231 unwrapper<F>::unwrap(f, 0)(a[base_type::a1_]); |
|
232 } |
|
233 |
|
234 template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const |
|
235 { |
|
236 unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_]); |
|
237 } |
|
238 |
|
239 template<class V> void accept(V & v) const |
|
240 { |
|
241 base_type::accept(v); |
|
242 } |
|
243 |
|
244 bool operator==(list1 const & rhs) const |
|
245 { |
|
246 return ref_compare(base_type::a1_, rhs.a1_, 0); |
|
247 } |
|
248 }; |
|
249 |
|
250 template< class A1, class A2 > class list2: private storage2< A1, A2 > |
|
251 { |
|
252 private: |
|
253 |
|
254 typedef storage2< A1, A2 > base_type; |
|
255 |
|
256 public: |
|
257 |
|
258 list2( A1 a1, A2 a2 ): base_type( a1, a2 ) {} |
|
259 |
|
260 A1 operator[] (boost::arg<1>) const { return base_type::a1_; } |
|
261 A2 operator[] (boost::arg<2>) const { return base_type::a2_; } |
|
262 |
|
263 A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } |
|
264 A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; } |
|
265 |
|
266 template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); } |
|
267 |
|
268 template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); } |
|
269 |
|
270 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); } |
|
271 |
|
272 template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const { return b.eval(*this); } |
|
273 |
|
274 template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); } |
|
275 |
|
276 template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long) |
|
277 { |
|
278 return unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]); |
|
279 } |
|
280 |
|
281 template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const |
|
282 { |
|
283 return unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]); |
|
284 } |
|
285 |
|
286 template<class F, class A> void operator()(type<void>, F & f, A & a, int) |
|
287 { |
|
288 unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]); |
|
289 } |
|
290 |
|
291 template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const |
|
292 { |
|
293 unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]); |
|
294 } |
|
295 |
|
296 template<class V> void accept(V & v) const |
|
297 { |
|
298 base_type::accept(v); |
|
299 } |
|
300 |
|
301 bool operator==(list2 const & rhs) const |
|
302 { |
|
303 return ref_compare(base_type::a1_, rhs.a1_, 0) && ref_compare(base_type::a2_, rhs.a2_, 0); |
|
304 } |
|
305 }; |
|
306 |
|
307 template< class A1, class A2, class A3 > class list3: private storage3< A1, A2, A3 > |
|
308 { |
|
309 private: |
|
310 |
|
311 typedef storage3< A1, A2, A3 > base_type; |
|
312 |
|
313 public: |
|
314 |
|
315 list3( A1 a1, A2 a2, A3 a3 ): base_type( a1, a2, a3 ) {} |
|
316 |
|
317 A1 operator[] (boost::arg<1>) const { return base_type::a1_; } |
|
318 A2 operator[] (boost::arg<2>) const { return base_type::a2_; } |
|
319 A3 operator[] (boost::arg<3>) const { return base_type::a3_; } |
|
320 |
|
321 A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } |
|
322 A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; } |
|
323 A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; } |
|
324 |
|
325 template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); } |
|
326 |
|
327 template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); } |
|
328 |
|
329 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); } |
|
330 |
|
331 template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const { return b.eval(*this); } |
|
332 |
|
333 template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); } |
|
334 |
|
335 template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long) |
|
336 { |
|
337 return unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]); |
|
338 } |
|
339 |
|
340 template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const |
|
341 { |
|
342 return unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]); |
|
343 } |
|
344 |
|
345 template<class F, class A> void operator()(type<void>, F & f, A & a, int) |
|
346 { |
|
347 unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]); |
|
348 } |
|
349 |
|
350 template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const |
|
351 { |
|
352 unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]); |
|
353 } |
|
354 |
|
355 template<class V> void accept(V & v) const |
|
356 { |
|
357 base_type::accept(v); |
|
358 } |
|
359 |
|
360 bool operator==(list3 const & rhs) const |
|
361 { |
|
362 return |
|
363 |
|
364 ref_compare( base_type::a1_, rhs.a1_, 0 ) && |
|
365 ref_compare( base_type::a2_, rhs.a2_, 0 ) && |
|
366 ref_compare( base_type::a3_, rhs.a3_, 0 ); |
|
367 } |
|
368 }; |
|
369 |
|
370 template< class A1, class A2, class A3, class A4 > class list4: private storage4< A1, A2, A3, A4 > |
|
371 { |
|
372 private: |
|
373 |
|
374 typedef storage4< A1, A2, A3, A4 > base_type; |
|
375 |
|
376 public: |
|
377 |
|
378 list4( A1 a1, A2 a2, A3 a3, A4 a4 ): base_type( a1, a2, a3, a4 ) {} |
|
379 |
|
380 A1 operator[] (boost::arg<1>) const { return base_type::a1_; } |
|
381 A2 operator[] (boost::arg<2>) const { return base_type::a2_; } |
|
382 A3 operator[] (boost::arg<3>) const { return base_type::a3_; } |
|
383 A4 operator[] (boost::arg<4>) const { return base_type::a4_; } |
|
384 |
|
385 A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } |
|
386 A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; } |
|
387 A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; } |
|
388 A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; } |
|
389 |
|
390 template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); } |
|
391 |
|
392 template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); } |
|
393 |
|
394 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); } |
|
395 |
|
396 template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const { return b.eval(*this); } |
|
397 |
|
398 template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); } |
|
399 |
|
400 template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long) |
|
401 { |
|
402 return unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]); |
|
403 } |
|
404 |
|
405 template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const |
|
406 { |
|
407 return unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]); |
|
408 } |
|
409 |
|
410 template<class F, class A> void operator()(type<void>, F & f, A & a, int) |
|
411 { |
|
412 unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]); |
|
413 } |
|
414 |
|
415 template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const |
|
416 { |
|
417 unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]); |
|
418 } |
|
419 |
|
420 template<class V> void accept(V & v) const |
|
421 { |
|
422 base_type::accept(v); |
|
423 } |
|
424 |
|
425 bool operator==(list4 const & rhs) const |
|
426 { |
|
427 return |
|
428 |
|
429 ref_compare( base_type::a1_, rhs.a1_, 0 ) && |
|
430 ref_compare( base_type::a2_, rhs.a2_, 0 ) && |
|
431 ref_compare( base_type::a3_, rhs.a3_, 0 ) && |
|
432 ref_compare( base_type::a4_, rhs.a4_, 0 ); |
|
433 } |
|
434 }; |
|
435 |
|
436 template< class A1, class A2, class A3, class A4, class A5 > class list5: private storage5< A1, A2, A3, A4, A5 > |
|
437 { |
|
438 private: |
|
439 |
|
440 typedef storage5< A1, A2, A3, A4, A5 > base_type; |
|
441 |
|
442 public: |
|
443 |
|
444 list5( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5 ): base_type( a1, a2, a3, a4, a5 ) {} |
|
445 |
|
446 A1 operator[] (boost::arg<1>) const { return base_type::a1_; } |
|
447 A2 operator[] (boost::arg<2>) const { return base_type::a2_; } |
|
448 A3 operator[] (boost::arg<3>) const { return base_type::a3_; } |
|
449 A4 operator[] (boost::arg<4>) const { return base_type::a4_; } |
|
450 A5 operator[] (boost::arg<5>) const { return base_type::a5_; } |
|
451 |
|
452 A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } |
|
453 A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; } |
|
454 A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; } |
|
455 A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; } |
|
456 A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; } |
|
457 |
|
458 template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); } |
|
459 |
|
460 template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); } |
|
461 |
|
462 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); } |
|
463 |
|
464 template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const { return b.eval(*this); } |
|
465 |
|
466 template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); } |
|
467 |
|
468 template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long) |
|
469 { |
|
470 return unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_]); |
|
471 } |
|
472 |
|
473 template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const |
|
474 { |
|
475 return unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_]); |
|
476 } |
|
477 |
|
478 template<class F, class A> void operator()(type<void>, F & f, A & a, int) |
|
479 { |
|
480 unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_]); |
|
481 } |
|
482 |
|
483 template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const |
|
484 { |
|
485 unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_]); |
|
486 } |
|
487 |
|
488 template<class V> void accept(V & v) const |
|
489 { |
|
490 base_type::accept(v); |
|
491 } |
|
492 |
|
493 bool operator==(list5 const & rhs) const |
|
494 { |
|
495 return |
|
496 |
|
497 ref_compare( base_type::a1_, rhs.a1_, 0 ) && |
|
498 ref_compare( base_type::a2_, rhs.a2_, 0 ) && |
|
499 ref_compare( base_type::a3_, rhs.a3_, 0 ) && |
|
500 ref_compare( base_type::a4_, rhs.a4_, 0 ) && |
|
501 ref_compare( base_type::a5_, rhs.a5_, 0 ); |
|
502 } |
|
503 }; |
|
504 |
|
505 template<class A1, class A2, class A3, class A4, class A5, class A6> class list6: private storage6< A1, A2, A3, A4, A5, A6 > |
|
506 { |
|
507 private: |
|
508 |
|
509 typedef storage6< A1, A2, A3, A4, A5, A6 > base_type; |
|
510 |
|
511 public: |
|
512 |
|
513 list6( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6 ): base_type( a1, a2, a3, a4, a5, a6 ) {} |
|
514 |
|
515 A1 operator[] (boost::arg<1>) const { return base_type::a1_; } |
|
516 A2 operator[] (boost::arg<2>) const { return base_type::a2_; } |
|
517 A3 operator[] (boost::arg<3>) const { return base_type::a3_; } |
|
518 A4 operator[] (boost::arg<4>) const { return base_type::a4_; } |
|
519 A5 operator[] (boost::arg<5>) const { return base_type::a5_; } |
|
520 A6 operator[] (boost::arg<6>) const { return base_type::a6_; } |
|
521 |
|
522 A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } |
|
523 A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; } |
|
524 A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; } |
|
525 A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; } |
|
526 A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; } |
|
527 A6 operator[] (boost::arg<6> (*) ()) const { return base_type::a6_; } |
|
528 |
|
529 template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); } |
|
530 |
|
531 template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); } |
|
532 |
|
533 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); } |
|
534 |
|
535 template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const { return b.eval(*this); } |
|
536 |
|
537 template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); } |
|
538 |
|
539 template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long) |
|
540 { |
|
541 return unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_]); |
|
542 } |
|
543 |
|
544 template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const |
|
545 { |
|
546 return unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_]); |
|
547 } |
|
548 |
|
549 template<class F, class A> void operator()(type<void>, F & f, A & a, int) |
|
550 { |
|
551 unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_]); |
|
552 } |
|
553 |
|
554 template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const |
|
555 { |
|
556 unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_]); |
|
557 } |
|
558 |
|
559 template<class V> void accept(V & v) const |
|
560 { |
|
561 base_type::accept(v); |
|
562 } |
|
563 |
|
564 bool operator==(list6 const & rhs) const |
|
565 { |
|
566 return |
|
567 |
|
568 ref_compare( base_type::a1_, rhs.a1_, 0 ) && |
|
569 ref_compare( base_type::a2_, rhs.a2_, 0 ) && |
|
570 ref_compare( base_type::a3_, rhs.a3_, 0 ) && |
|
571 ref_compare( base_type::a4_, rhs.a4_, 0 ) && |
|
572 ref_compare( base_type::a5_, rhs.a5_, 0 ) && |
|
573 ref_compare( base_type::a6_, rhs.a6_, 0 ); |
|
574 } |
|
575 }; |
|
576 |
|
577 template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> class list7: private storage7< A1, A2, A3, A4, A5, A6, A7 > |
|
578 { |
|
579 private: |
|
580 |
|
581 typedef storage7< A1, A2, A3, A4, A5, A6, A7 > base_type; |
|
582 |
|
583 public: |
|
584 |
|
585 list7( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7 ): base_type( a1, a2, a3, a4, a5, a6, a7 ) {} |
|
586 |
|
587 A1 operator[] (boost::arg<1>) const { return base_type::a1_; } |
|
588 A2 operator[] (boost::arg<2>) const { return base_type::a2_; } |
|
589 A3 operator[] (boost::arg<3>) const { return base_type::a3_; } |
|
590 A4 operator[] (boost::arg<4>) const { return base_type::a4_; } |
|
591 A5 operator[] (boost::arg<5>) const { return base_type::a5_; } |
|
592 A6 operator[] (boost::arg<6>) const { return base_type::a6_; } |
|
593 A7 operator[] (boost::arg<7>) const { return base_type::a7_; } |
|
594 |
|
595 A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } |
|
596 A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; } |
|
597 A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; } |
|
598 A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; } |
|
599 A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; } |
|
600 A6 operator[] (boost::arg<6> (*) ()) const { return base_type::a6_; } |
|
601 A7 operator[] (boost::arg<7> (*) ()) const { return base_type::a7_; } |
|
602 |
|
603 template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); } |
|
604 |
|
605 template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); } |
|
606 |
|
607 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); } |
|
608 |
|
609 template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const { return b.eval(*this); } |
|
610 |
|
611 template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); } |
|
612 |
|
613 template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long) |
|
614 { |
|
615 return unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_]); |
|
616 } |
|
617 |
|
618 template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const |
|
619 { |
|
620 return unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_]); |
|
621 } |
|
622 |
|
623 template<class F, class A> void operator()(type<void>, F & f, A & a, int) |
|
624 { |
|
625 unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_]); |
|
626 } |
|
627 |
|
628 template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const |
|
629 { |
|
630 unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_]); |
|
631 } |
|
632 |
|
633 template<class V> void accept(V & v) const |
|
634 { |
|
635 base_type::accept(v); |
|
636 } |
|
637 |
|
638 bool operator==(list7 const & rhs) const |
|
639 { |
|
640 return |
|
641 |
|
642 ref_compare( base_type::a1_, rhs.a1_, 0 ) && |
|
643 ref_compare( base_type::a2_, rhs.a2_, 0 ) && |
|
644 ref_compare( base_type::a3_, rhs.a3_, 0 ) && |
|
645 ref_compare( base_type::a4_, rhs.a4_, 0 ) && |
|
646 ref_compare( base_type::a5_, rhs.a5_, 0 ) && |
|
647 ref_compare( base_type::a6_, rhs.a6_, 0 ) && |
|
648 ref_compare( base_type::a7_, rhs.a7_, 0 ); |
|
649 } |
|
650 }; |
|
651 |
|
652 template< class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8 > class list8: private storage8< A1, A2, A3, A4, A5, A6, A7, A8 > |
|
653 { |
|
654 private: |
|
655 |
|
656 typedef storage8< A1, A2, A3, A4, A5, A6, A7, A8 > base_type; |
|
657 |
|
658 public: |
|
659 |
|
660 list8( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8 ): base_type( a1, a2, a3, a4, a5, a6, a7, a8 ) {} |
|
661 |
|
662 A1 operator[] (boost::arg<1>) const { return base_type::a1_; } |
|
663 A2 operator[] (boost::arg<2>) const { return base_type::a2_; } |
|
664 A3 operator[] (boost::arg<3>) const { return base_type::a3_; } |
|
665 A4 operator[] (boost::arg<4>) const { return base_type::a4_; } |
|
666 A5 operator[] (boost::arg<5>) const { return base_type::a5_; } |
|
667 A6 operator[] (boost::arg<6>) const { return base_type::a6_; } |
|
668 A7 operator[] (boost::arg<7>) const { return base_type::a7_; } |
|
669 A8 operator[] (boost::arg<8>) const { return base_type::a8_; } |
|
670 |
|
671 A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } |
|
672 A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; } |
|
673 A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; } |
|
674 A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; } |
|
675 A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; } |
|
676 A6 operator[] (boost::arg<6> (*) ()) const { return base_type::a6_; } |
|
677 A7 operator[] (boost::arg<7> (*) ()) const { return base_type::a7_; } |
|
678 A8 operator[] (boost::arg<8> (*) ()) const { return base_type::a8_; } |
|
679 |
|
680 template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); } |
|
681 |
|
682 template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); } |
|
683 |
|
684 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); } |
|
685 |
|
686 template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const { return b.eval(*this); } |
|
687 |
|
688 template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); } |
|
689 |
|
690 template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long) |
|
691 { |
|
692 return unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_]); |
|
693 } |
|
694 |
|
695 template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const |
|
696 { |
|
697 return unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_]); |
|
698 } |
|
699 |
|
700 template<class F, class A> void operator()(type<void>, F & f, A & a, int) |
|
701 { |
|
702 unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_]); |
|
703 } |
|
704 |
|
705 template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const |
|
706 { |
|
707 unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_]); |
|
708 } |
|
709 |
|
710 template<class V> void accept(V & v) const |
|
711 { |
|
712 base_type::accept(v); |
|
713 } |
|
714 |
|
715 bool operator==(list8 const & rhs) const |
|
716 { |
|
717 return |
|
718 |
|
719 ref_compare( base_type::a1_, rhs.a1_, 0 ) && |
|
720 ref_compare( base_type::a2_, rhs.a2_, 0 ) && |
|
721 ref_compare( base_type::a3_, rhs.a3_, 0 ) && |
|
722 ref_compare( base_type::a4_, rhs.a4_, 0 ) && |
|
723 ref_compare( base_type::a5_, rhs.a5_, 0 ) && |
|
724 ref_compare( base_type::a6_, rhs.a6_, 0 ) && |
|
725 ref_compare( base_type::a7_, rhs.a7_, 0 ) && |
|
726 ref_compare( base_type::a8_, rhs.a8_, 0 ); |
|
727 } |
|
728 }; |
|
729 |
|
730 template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> class list9: private storage9< A1, A2, A3, A4, A5, A6, A7, A8, A9 > |
|
731 { |
|
732 private: |
|
733 |
|
734 typedef storage9< A1, A2, A3, A4, A5, A6, A7, A8, A9 > base_type; |
|
735 |
|
736 public: |
|
737 |
|
738 list9( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9 ): base_type( a1, a2, a3, a4, a5, a6, a7, a8, a9 ) {} |
|
739 |
|
740 A1 operator[] (boost::arg<1>) const { return base_type::a1_; } |
|
741 A2 operator[] (boost::arg<2>) const { return base_type::a2_; } |
|
742 A3 operator[] (boost::arg<3>) const { return base_type::a3_; } |
|
743 A4 operator[] (boost::arg<4>) const { return base_type::a4_; } |
|
744 A5 operator[] (boost::arg<5>) const { return base_type::a5_; } |
|
745 A6 operator[] (boost::arg<6>) const { return base_type::a6_; } |
|
746 A7 operator[] (boost::arg<7>) const { return base_type::a7_; } |
|
747 A8 operator[] (boost::arg<8>) const { return base_type::a8_; } |
|
748 A9 operator[] (boost::arg<9>) const { return base_type::a9_; } |
|
749 |
|
750 A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } |
|
751 A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; } |
|
752 A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; } |
|
753 A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; } |
|
754 A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; } |
|
755 A6 operator[] (boost::arg<6> (*) ()) const { return base_type::a6_; } |
|
756 A7 operator[] (boost::arg<7> (*) ()) const { return base_type::a7_; } |
|
757 A8 operator[] (boost::arg<8> (*) ()) const { return base_type::a8_; } |
|
758 A9 operator[] (boost::arg<9> (*) ()) const { return base_type::a9_; } |
|
759 |
|
760 template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); } |
|
761 |
|
762 template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); } |
|
763 |
|
764 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); } |
|
765 |
|
766 template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const { return b.eval(*this); } |
|
767 |
|
768 template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); } |
|
769 |
|
770 template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long) |
|
771 { |
|
772 return unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_], a[base_type::a9_]); |
|
773 } |
|
774 |
|
775 template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const |
|
776 { |
|
777 return unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_], a[base_type::a9_]); |
|
778 } |
|
779 |
|
780 template<class F, class A> void operator()(type<void>, F & f, A & a, int) |
|
781 { |
|
782 unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_], a[base_type::a9_]); |
|
783 } |
|
784 |
|
785 template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const |
|
786 { |
|
787 unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_], a[base_type::a9_]); |
|
788 } |
|
789 |
|
790 template<class V> void accept(V & v) const |
|
791 { |
|
792 base_type::accept(v); |
|
793 } |
|
794 |
|
795 bool operator==(list9 const & rhs) const |
|
796 { |
|
797 return |
|
798 |
|
799 ref_compare( base_type::a1_, rhs.a1_, 0 ) && |
|
800 ref_compare( base_type::a2_, rhs.a2_, 0 ) && |
|
801 ref_compare( base_type::a3_, rhs.a3_, 0 ) && |
|
802 ref_compare( base_type::a4_, rhs.a4_, 0 ) && |
|
803 ref_compare( base_type::a5_, rhs.a5_, 0 ) && |
|
804 ref_compare( base_type::a6_, rhs.a6_, 0 ) && |
|
805 ref_compare( base_type::a7_, rhs.a7_, 0 ) && |
|
806 ref_compare( base_type::a8_, rhs.a8_, 0 ) && |
|
807 ref_compare( base_type::a9_, rhs.a9_, 0 ); |
|
808 } |
|
809 }; |
|
810 |
|
811 // bind_t |
|
812 |
|
813 #ifndef BOOST_NO_VOID_RETURNS |
|
814 |
|
815 template<class R, class F, class L> class bind_t |
|
816 { |
|
817 public: |
|
818 |
|
819 typedef bind_t this_type; |
|
820 |
|
821 bind_t(F f, L const & l): f_(f), l_(l) {} |
|
822 |
|
823 #define BOOST_BIND_RETURN return |
|
824 #include <boost/bind/bind_template.hpp> |
|
825 #undef BOOST_BIND_RETURN |
|
826 |
|
827 }; |
|
828 |
114 #else |
829 #else |
115 # define AUX778076_BIND_NESTED_DEFAULT_PARAMS(param, value) \ |
830 |
116 AUX778076_BIND_PARAMS(param) \ |
831 template<class R> struct bind_t_generator |
117 /**/ |
832 { |
118 #endif |
833 |
119 |
834 template<class F, class L> class implementation |
120 namespace aux { |
835 { |
121 |
836 public: |
122 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) |
837 |
123 |
838 typedef implementation this_type; |
124 template< |
839 |
125 typename T, AUX778076_BIND_PARAMS(typename U) |
840 implementation(F f, L const & l): f_(f), l_(l) {} |
126 > |
841 |
127 struct resolve_bind_arg |
842 #define BOOST_BIND_RETURN return |
128 { |
843 #include <boost/bind/bind_template.hpp> |
129 typedef T type; |
844 #undef BOOST_BIND_RETURN |
130 }; |
845 |
131 |
846 }; |
132 # if !defined(BOOST_MPL_CFG_NO_UNNAMED_PLACEHOLDER_SUPPORT) |
847 |
133 |
848 }; |
134 template< |
849 |
135 typename T |
850 template<> struct bind_t_generator<void> |
136 , typename Arg |
851 { |
137 > |
852 |
138 struct replace_unnamed_arg |
853 template<class F, class L> class implementation |
139 { |
854 { |
140 typedef Arg next; |
855 private: |
141 typedef T type; |
856 |
142 }; |
857 typedef void R; |
143 |
858 |
144 template< |
859 public: |
145 typename Arg |
860 |
146 > |
861 typedef implementation this_type; |
147 struct replace_unnamed_arg< arg<-1>,Arg > |
862 |
148 { |
863 implementation(F f, L const & l): f_(f), l_(l) {} |
149 typedef typename Arg::next next; |
864 |
150 typedef Arg type; |
865 #define BOOST_BIND_RETURN |
151 }; |
866 #include <boost/bind/bind_template.hpp> |
152 |
867 #undef BOOST_BIND_RETURN |
153 # endif // BOOST_MPL_CFG_NO_UNNAMED_PLACEHOLDER_SUPPORT |
868 |
154 |
869 }; |
155 template< |
870 |
156 BOOST_MPL_AUX_NTTP_DECL(int, N), AUX778076_BIND_PARAMS(typename U) |
871 }; |
157 > |
872 |
158 struct resolve_bind_arg< arg<N>,AUX778076_BIND_PARAMS(U) > |
873 template<class R2, class F, class L> class bind_t: public bind_t_generator<R2>::BOOST_NESTED_TEMPLATE implementation<F, L> |
159 { |
874 { |
160 typedef typename AUX778076_APPLY<mpl::arg<N>, AUX778076_BIND_PARAMS(U)>::type type; |
875 public: |
161 }; |
876 |
162 |
877 bind_t(F f, L const & l): bind_t_generator<R2>::BOOST_NESTED_TEMPLATE implementation<F, L>(f, l) {} |
163 #if !defined(BOOST_MPL_CFG_NO_BIND_TEMPLATE) |
878 |
164 template< |
879 }; |
165 typename F, AUX778076_BIND_PARAMS(typename T), AUX778076_BIND_PARAMS(typename U) |
880 |
166 > |
881 #endif |
167 struct resolve_bind_arg< bind<F,AUX778076_BIND_PARAMS(T)>,AUX778076_BIND_PARAMS(U) > |
882 |
168 { |
883 // function_equal |
169 typedef bind<F,AUX778076_BIND_PARAMS(T)> f_; |
884 |
170 typedef typename AUX778076_APPLY<f_, AUX778076_BIND_PARAMS(U)>::type type; |
885 #ifndef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP |
171 }; |
886 |
172 #endif |
887 // put overloads in _bi, rely on ADL |
173 |
888 |
174 #else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION |
889 # ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING |
175 |
890 |
176 // agurt, 15/jan/02: it's not a intended to be used as a function class, and |
891 template<class R, class F, class L> bool function_equal( bind_t<R, F, L> const & a, bind_t<R, F, L> const & b ) |
177 // MSVC6.5 has problems with 'apply' name here (the code compiles, but doesn't |
892 { |
178 // work), so I went with the 'result_' here, and in all other similar cases |
893 return a.compare(b); |
179 template< bool > |
894 } |
180 struct resolve_arg_impl |
895 |
181 { |
896 # else |
182 template< typename T, AUX778076_BIND_PARAMS(typename U) > struct result_ |
897 |
|
898 template<class R, class F, class L> bool function_equal_impl( bind_t<R, F, L> const & a, bind_t<R, F, L> const & b, int ) |
|
899 { |
|
900 return a.compare(b); |
|
901 } |
|
902 |
|
903 # endif // #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING |
|
904 |
|
905 #else // BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP |
|
906 |
|
907 // put overloads in boost |
|
908 |
|
909 } // namespace _bi |
|
910 |
|
911 # ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING |
|
912 |
|
913 template<class R, class F, class L> bool function_equal( _bi::bind_t<R, F, L> const & a, _bi::bind_t<R, F, L> const & b ) |
|
914 { |
|
915 return a.compare(b); |
|
916 } |
|
917 |
|
918 # else |
|
919 |
|
920 template<class R, class F, class L> bool function_equal_impl( _bi::bind_t<R, F, L> const & a, _bi::bind_t<R, F, L> const & b, int ) |
|
921 { |
|
922 return a.compare(b); |
|
923 } |
|
924 |
|
925 # endif // #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING |
|
926 |
|
927 namespace _bi |
|
928 { |
|
929 |
|
930 #endif // BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP |
|
931 |
|
932 // add_value |
|
933 |
|
934 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) || (__SUNPRO_CC >= 0x530) |
|
935 |
|
936 template<class T> struct add_value |
|
937 { |
|
938 typedef _bi::value<T> type; |
|
939 }; |
|
940 |
|
941 template<class T> struct add_value< value<T> > |
|
942 { |
|
943 typedef _bi::value<T> type; |
|
944 }; |
|
945 |
|
946 template<class T> struct add_value< reference_wrapper<T> > |
|
947 { |
|
948 typedef reference_wrapper<T> type; |
|
949 }; |
|
950 |
|
951 template<int I> struct add_value< arg<I> > |
|
952 { |
|
953 typedef boost::arg<I> type; |
|
954 }; |
|
955 |
|
956 template<int I> struct add_value< arg<I> (*) () > |
|
957 { |
|
958 typedef boost::arg<I> (*type) (); |
|
959 }; |
|
960 |
|
961 template<class R, class F, class L> struct add_value< bind_t<R, F, L> > |
|
962 { |
|
963 typedef bind_t<R, F, L> type; |
|
964 }; |
|
965 |
|
966 #else |
|
967 |
|
968 template<int I> struct _avt_0; |
|
969 |
|
970 template<> struct _avt_0<1> |
|
971 { |
|
972 template<class T> struct inner |
183 { |
973 { |
184 typedef T type; |
974 typedef T type; |
185 }; |
975 }; |
186 }; |
976 }; |
187 |
977 |
188 template<> |
978 template<> struct _avt_0<2> |
189 struct resolve_arg_impl<true> |
979 { |
190 { |
980 template<class T> struct inner |
191 template< typename T, AUX778076_BIND_PARAMS(typename U) > struct result_ |
981 { |
192 { |
982 typedef value<T> type; |
193 typedef typename AUX778076_APPLY< |
|
194 T |
|
195 , AUX778076_BIND_PARAMS(U) |
|
196 >::type type; |
|
197 }; |
983 }; |
198 }; |
984 }; |
199 |
985 |
200 // for 'resolve_bind_arg' |
986 typedef char (&_avt_r1) [1]; |
201 template< typename T > struct is_bind_template; |
987 typedef char (&_avt_r2) [2]; |
202 |
988 |
203 template< |
989 template<class T> _avt_r1 _avt_f(value<T>); |
204 typename T, AUX778076_BIND_PARAMS(typename U) |
990 template<class T> _avt_r1 _avt_f(reference_wrapper<T>); |
205 > |
991 template<int I> _avt_r1 _avt_f(arg<I>); |
206 struct resolve_bind_arg |
992 template<int I> _avt_r1 _avt_f(arg<I> (*) ()); |
207 : resolve_arg_impl< is_bind_template<T>::value > |
993 template<class R, class F, class L> _avt_r1 _avt_f(bind_t<R, F, L>); |
208 ::template result_< T,AUX778076_BIND_PARAMS(U) > |
994 |
209 { |
995 _avt_r2 _avt_f(...); |
210 }; |
996 |
211 |
997 template<class T> struct add_value |
212 # if !defined(BOOST_MPL_CFG_NO_UNNAMED_PLACEHOLDER_SUPPORT) |
998 { |
213 |
999 static T t(); |
214 template< typename T > |
1000 typedef typename _avt_0<sizeof(_avt_f(t()))>::template inner<T>::type type; |
215 struct replace_unnamed_arg_impl |
1001 }; |
216 { |
1002 |
217 template< typename Arg > struct result_ |
1003 #endif |
218 { |
1004 |
219 typedef Arg next; |
1005 // list_av_N |
220 typedef T type; |
1006 |
221 }; |
1007 template<class A1> struct list_av_1 |
222 }; |
1008 { |
223 |
1009 typedef typename add_value<A1>::type B1; |
224 template<> |
1010 typedef list1<B1> type; |
225 struct replace_unnamed_arg_impl< arg<-1> > |
1011 }; |
226 { |
1012 |
227 template< typename Arg > struct result_ |
1013 template<class A1, class A2> struct list_av_2 |
228 { |
1014 { |
229 typedef typename next<Arg>::type next; |
1015 typedef typename add_value<A1>::type B1; |
230 typedef Arg type; |
1016 typedef typename add_value<A2>::type B2; |
231 }; |
1017 typedef list2<B1, B2> type; |
232 }; |
1018 }; |
233 |
1019 |
234 template< typename T, typename Arg > |
1020 template<class A1, class A2, class A3> struct list_av_3 |
235 struct replace_unnamed_arg |
1021 { |
236 : replace_unnamed_arg_impl<T>::template result_<Arg> |
1022 typedef typename add_value<A1>::type B1; |
237 { |
1023 typedef typename add_value<A2>::type B2; |
238 }; |
1024 typedef typename add_value<A3>::type B3; |
239 |
1025 typedef list3<B1, B2, B3> type; |
240 # endif // BOOST_MPL_CFG_NO_UNNAMED_PLACEHOLDER_SUPPORT |
1026 }; |
241 |
1027 |
242 // agurt, 10/mar/02: the forward declaration has to appear before any of |
1028 template<class A1, class A2, class A3, class A4> struct list_av_4 |
243 // 'is_bind_helper' overloads, otherwise MSVC6.5 issues an ICE on it |
1029 { |
244 template< BOOST_MPL_AUX_NTTP_DECL(int, arity_) > struct bind_chooser; |
1030 typedef typename add_value<A1>::type B1; |
245 |
1031 typedef typename add_value<A2>::type B2; |
246 aux::no_tag is_bind_helper(...); |
1032 typedef typename add_value<A3>::type B3; |
247 template< typename T > aux::no_tag is_bind_helper(protect<T>*); |
1033 typedef typename add_value<A4>::type B4; |
248 |
1034 typedef list4<B1, B2, B3, B4> type; |
249 // overload for "main" form |
1035 }; |
250 // agurt, 15/mar/02: MSVC 6.5 fails to properly resolve the overload |
1036 |
251 // in case if we use 'aux::type_wrapper< bind<...> >' here, and all |
1037 template<class A1, class A2, class A3, class A4, class A5> struct list_av_5 |
252 // 'bind' instantiations form a complete type anyway |
1038 { |
253 #if !defined(BOOST_MPL_CFG_NO_BIND_TEMPLATE) |
1039 typedef typename add_value<A1>::type B1; |
254 template< |
1040 typedef typename add_value<A2>::type B2; |
255 typename F, AUX778076_BIND_PARAMS(typename T) |
1041 typedef typename add_value<A3>::type B3; |
256 > |
1042 typedef typename add_value<A4>::type B4; |
257 aux::yes_tag is_bind_helper(bind<F,AUX778076_BIND_PARAMS(T)>*); |
1043 typedef typename add_value<A5>::type B5; |
258 #endif |
1044 typedef list5<B1, B2, B3, B4, B5> type; |
259 |
1045 }; |
260 template< BOOST_MPL_AUX_NTTP_DECL(int, N) > |
1046 |
261 aux::yes_tag is_bind_helper(arg<N>*); |
1047 template<class A1, class A2, class A3, class A4, class A5, class A6> struct list_av_6 |
262 |
1048 { |
263 template< bool is_ref_ = true > |
1049 typedef typename add_value<A1>::type B1; |
264 struct is_bind_template_impl |
1050 typedef typename add_value<A2>::type B2; |
265 { |
1051 typedef typename add_value<A3>::type B3; |
266 template< typename T > struct result_ |
1052 typedef typename add_value<A4>::type B4; |
267 { |
1053 typedef typename add_value<A5>::type B5; |
268 BOOST_STATIC_CONSTANT(bool, value = false); |
1054 typedef typename add_value<A6>::type B6; |
269 }; |
1055 typedef list6<B1, B2, B3, B4, B5, B6> type; |
270 }; |
1056 }; |
271 |
1057 |
272 template<> |
1058 template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> struct list_av_7 |
273 struct is_bind_template_impl<false> |
1059 { |
274 { |
1060 typedef typename add_value<A1>::type B1; |
275 template< typename T > struct result_ |
1061 typedef typename add_value<A2>::type B2; |
276 { |
1062 typedef typename add_value<A3>::type B3; |
277 BOOST_STATIC_CONSTANT(bool, value = |
1063 typedef typename add_value<A4>::type B4; |
278 sizeof(aux::is_bind_helper(static_cast<T*>(0))) |
1064 typedef typename add_value<A5>::type B5; |
279 == sizeof(aux::yes_tag) |
1065 typedef typename add_value<A6>::type B6; |
280 ); |
1066 typedef typename add_value<A7>::type B7; |
281 }; |
1067 typedef list7<B1, B2, B3, B4, B5, B6, B7> type; |
282 }; |
1068 }; |
283 |
1069 |
284 template< typename T > struct is_bind_template |
1070 template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> struct list_av_8 |
285 : is_bind_template_impl< ::boost::detail::is_reference_impl<T>::value > |
1071 { |
286 ::template result_<T> |
1072 typedef typename add_value<A1>::type B1; |
287 { |
1073 typedef typename add_value<A2>::type B2; |
288 }; |
1074 typedef typename add_value<A3>::type B3; |
289 |
1075 typedef typename add_value<A4>::type B4; |
290 #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION |
1076 typedef typename add_value<A5>::type B5; |
291 |
1077 typedef typename add_value<A6>::type B6; |
292 } // namespace aux |
1078 typedef typename add_value<A7>::type B7; |
293 |
1079 typedef typename add_value<A8>::type B8; |
294 |
1080 typedef list8<B1, B2, B3, B4, B5, B6, B7, B8> type; |
295 #define BOOST_PP_ITERATION_PARAMS_1 \ |
1081 }; |
296 (3,(0, BOOST_MPL_LIMIT_METAFUNCTION_ARITY, <boost/mpl/bind.hpp>)) |
1082 |
297 #include BOOST_PP_ITERATE() |
1083 template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> struct list_av_9 |
298 |
1084 { |
299 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ |
1085 typedef typename add_value<A1>::type B1; |
300 && !defined(BOOST_MPL_CFG_NO_TEMPLATE_TEMPLATE_PARAMETERS) |
1086 typedef typename add_value<A2>::type B2; |
301 /// if_/eval_if specializations |
1087 typedef typename add_value<A3>::type B3; |
302 # define AUX778076_SPEC_NAME if_ |
1088 typedef typename add_value<A4>::type B4; |
303 # define BOOST_PP_ITERATION_PARAMS_1 (3,(3, 3, <boost/mpl/bind.hpp>)) |
1089 typedef typename add_value<A5>::type B5; |
304 # include BOOST_PP_ITERATE() |
1090 typedef typename add_value<A6>::type B6; |
305 |
1091 typedef typename add_value<A7>::type B7; |
306 #if !defined(BOOST_MPL_CFG_DMC_AMBIGUOUS_CTPS) |
1092 typedef typename add_value<A8>::type B8; |
307 # define AUX778076_SPEC_NAME eval_if |
1093 typedef typename add_value<A9>::type B9; |
308 # define BOOST_PP_ITERATION_PARAMS_1 (3,(3, 3, <boost/mpl/bind.hpp>)) |
1094 typedef list9<B1, B2, B3, B4, B5, B6, B7, B8, B9> type; |
309 # include BOOST_PP_ITERATE() |
1095 }; |
310 #endif |
1096 |
311 #endif |
1097 // operator! |
312 |
1098 |
313 // real C++ version is already taken care of |
1099 struct logical_not |
314 #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ |
1100 { |
315 && !defined(BOOST_MPL_CFG_NO_BIND_TEMPLATE) |
1101 template<class V> bool operator()(V const & v) const { return !v; } |
316 |
1102 }; |
317 namespace aux { |
1103 |
318 // apply_count_args |
1104 template<class R, class F, class L> |
319 #define AUX778076_COUNT_ARGS_PREFIX bind |
1105 bind_t< bool, logical_not, list1< bind_t<R, F, L> > > |
320 #define AUX778076_COUNT_ARGS_DEFAULT na |
1106 operator! (bind_t<R, F, L> const & f) |
321 #define AUX778076_COUNT_ARGS_ARITY BOOST_MPL_LIMIT_METAFUNCTION_ARITY |
1107 { |
322 #include <boost/mpl/aux_/count_args.hpp> |
1108 typedef list1< bind_t<R, F, L> > list_type; |
323 } |
1109 return bind_t<bool, logical_not, list_type> ( logical_not(), list_type(f) ); |
|
1110 } |
|
1111 |
|
1112 // relational operators |
|
1113 |
|
1114 #define BOOST_BIND_OPERATOR( op, name ) \ |
|
1115 \ |
|
1116 struct name \ |
|
1117 { \ |
|
1118 template<class V, class W> bool operator()(V const & v, W const & w) const { return v op w; } \ |
|
1119 }; \ |
|
1120 \ |
|
1121 template<class R, class F, class L, class A2> \ |
|
1122 bind_t< bool, name, list2< bind_t<R, F, L>, typename add_value<A2>::type > > \ |
|
1123 operator op (bind_t<R, F, L> const & f, A2 a2) \ |
|
1124 { \ |
|
1125 typedef typename add_value<A2>::type B2; \ |
|
1126 typedef list2< bind_t<R, F, L>, B2> list_type; \ |
|
1127 return bind_t<bool, name, list_type> ( name(), list_type(f, a2) ); \ |
|
1128 } |
|
1129 |
|
1130 BOOST_BIND_OPERATOR( ==, equal ) |
|
1131 BOOST_BIND_OPERATOR( !=, not_equal ) |
|
1132 |
|
1133 BOOST_BIND_OPERATOR( <, less ) |
|
1134 BOOST_BIND_OPERATOR( <=, less_equal ) |
|
1135 |
|
1136 BOOST_BIND_OPERATOR( >, greater ) |
|
1137 BOOST_BIND_OPERATOR( >=, greater_equal ) |
|
1138 |
|
1139 #undef BOOST_BIND_OPERATOR |
|
1140 |
|
1141 #if defined(__GNUC__) && BOOST_WORKAROUND(__GNUC__, < 3) |
|
1142 |
|
1143 // resolve ambiguity with rel_ops |
|
1144 |
|
1145 #define BOOST_BIND_OPERATOR( op, name ) \ |
|
1146 \ |
|
1147 template<class R, class F, class L> \ |
|
1148 bind_t< bool, name, list2< bind_t<R, F, L>, bind_t<R, F, L> > > \ |
|
1149 operator op (bind_t<R, F, L> const & f, bind_t<R, F, L> const & g) \ |
|
1150 { \ |
|
1151 typedef list2< bind_t<R, F, L>, bind_t<R, F, L> > list_type; \ |
|
1152 return bind_t<bool, name, list_type> ( name(), list_type(f, g) ); \ |
|
1153 } |
|
1154 |
|
1155 BOOST_BIND_OPERATOR( !=, not_equal ) |
|
1156 BOOST_BIND_OPERATOR( <=, less_equal ) |
|
1157 BOOST_BIND_OPERATOR( >, greater ) |
|
1158 BOOST_BIND_OPERATOR( >=, greater_equal ) |
|
1159 |
|
1160 #endif |
|
1161 |
|
1162 // visit_each, ADL |
|
1163 |
|
1164 #if !defined( BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP ) && !defined( __BORLANDC__ ) \ |
|
1165 && !(defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ <= 3) |
|
1166 |
|
1167 template<class V, class T> void visit_each( V & v, value<T> const & t, int ) |
|
1168 { |
|
1169 using boost::visit_each; |
|
1170 BOOST_BIND_VISIT_EACH( v, t.get(), 0 ); |
|
1171 } |
|
1172 |
|
1173 template<class V, class R, class F, class L> void visit_each( V & v, bind_t<R, F, L> const & t, int ) |
|
1174 { |
|
1175 t.accept( v ); |
|
1176 } |
|
1177 |
|
1178 #endif |
|
1179 |
|
1180 } // namespace _bi |
|
1181 |
|
1182 // visit_each, no ADL |
|
1183 |
|
1184 #if defined( BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP ) || defined( __BORLANDC__ ) \ |
|
1185 || (defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ <= 3) |
|
1186 |
|
1187 template<class V, class T> void visit_each( V & v, _bi::value<T> const & t, int ) |
|
1188 { |
|
1189 BOOST_BIND_VISIT_EACH( v, t.get(), 0 ); |
|
1190 } |
|
1191 |
|
1192 template<class V, class R, class F, class L> void visit_each( V & v, _bi::bind_t<R, F, L> const & t, int ) |
|
1193 { |
|
1194 t.accept( v ); |
|
1195 } |
|
1196 |
|
1197 #endif |
324 |
1198 |
325 // bind |
1199 // bind |
326 template< |
1200 |
327 typename F, AUX778076_BIND_PARAMS(typename T) AUX778076_DMC_PARAM() |
1201 #ifndef BOOST_BIND |
328 > |
1202 #define BOOST_BIND bind |
329 struct bind |
1203 #endif |
330 : aux::bind_chooser< |
1204 |
331 aux::bind_count_args<AUX778076_BIND_PARAMS(T)>::value |
1205 // generic function objects |
332 >::template result_< F,AUX778076_BIND_PARAMS(T) >::type |
1206 |
333 { |
1207 template<class R, class F> |
334 }; |
1208 _bi::bind_t<R, F, _bi::list0> |
335 |
1209 BOOST_BIND(F f) |
336 BOOST_MPL_AUX_ARITY_SPEC( |
1210 { |
337 BOOST_PP_INC(BOOST_MPL_LIMIT_METAFUNCTION_ARITY) |
1211 typedef _bi::list0 list_type; |
338 , bind |
1212 return _bi::bind_t<R, F, list_type> (f, list_type()); |
339 ) |
1213 } |
340 |
1214 |
341 BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC( |
1215 template<class R, class F, class A1> |
342 BOOST_PP_INC(BOOST_MPL_LIMIT_METAFUNCTION_ARITY) |
1216 _bi::bind_t<R, F, typename _bi::list_av_1<A1>::type> |
343 , bind |
1217 BOOST_BIND(F f, A1 a1) |
344 ) |
1218 { |
345 |
1219 typedef typename _bi::list_av_1<A1>::type list_type; |
346 |
1220 return _bi::bind_t<R, F, list_type> (f, list_type(a1)); |
347 #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION |
1221 } |
348 |
1222 |
349 # undef AUX778076_BIND_NESTED_DEFAULT_PARAMS |
1223 template<class R, class F, class A1, class A2> |
350 # undef AUX778076_BIND_N_SPEC_PARAMS |
1224 _bi::bind_t<R, F, typename _bi::list_av_2<A1, A2>::type> |
351 # undef AUX778076_BIND_N_PARAMS |
1225 BOOST_BIND(F f, A1 a1, A2 a2) |
352 # undef AUX778076_BIND_DEFAULT_PARAMS |
1226 { |
353 # undef AUX778076_BIND_PARAMS |
1227 typedef typename _bi::list_av_2<A1, A2>::type list_type; |
354 # undef AUX778076_DMC_PARAM |
1228 return _bi::bind_t<R, F, list_type> (f, list_type(a1, a2)); |
355 # undef AUX778076_APPLY |
1229 } |
356 |
1230 |
357 }} |
1231 template<class R, class F, class A1, class A2, class A3> |
358 |
1232 _bi::bind_t<R, F, typename _bi::list_av_3<A1, A2, A3>::type> |
359 #endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS |
1233 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3) |
360 #endif // BOOST_MPL_BIND_HPP_INCLUDED |
1234 { |
361 |
1235 typedef typename _bi::list_av_3<A1, A2, A3>::type list_type; |
362 ///// iteration, depth == 1 |
1236 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3)); |
363 |
1237 } |
364 #elif BOOST_PP_ITERATION_DEPTH() == 1 |
1238 |
365 |
1239 template<class R, class F, class A1, class A2, class A3, class A4> |
366 # define i_ BOOST_PP_FRAME_ITERATION(1) |
1240 _bi::bind_t<R, F, typename _bi::list_av_4<A1, A2, A3, A4>::type> |
367 |
1241 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4) |
368 #if defined(AUX778076_SPEC_NAME) |
1242 { |
369 |
1243 typedef typename _bi::list_av_4<A1, A2, A3, A4>::type list_type; |
370 // lazy metafunction specialization |
1244 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4)); |
371 template< template< BOOST_MPL_PP_PARAMS(i_, typename T) > class F, typename Tag > |
1245 } |
372 struct BOOST_PP_CAT(quote,i_); |
1246 |
373 |
1247 template<class R, class F, class A1, class A2, class A3, class A4, class A5> |
374 template< BOOST_MPL_PP_PARAMS(i_, typename T) > struct AUX778076_SPEC_NAME; |
1248 _bi::bind_t<R, F, typename _bi::list_av_5<A1, A2, A3, A4, A5>::type> |
375 |
1249 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) |
376 template< |
1250 { |
377 typename Tag AUX778076_BIND_N_PARAMS(i_, typename T) |
1251 typedef typename _bi::list_av_5<A1, A2, A3, A4, A5>::type list_type; |
378 > |
1252 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5)); |
379 struct BOOST_PP_CAT(bind,i_)< |
1253 } |
380 BOOST_PP_CAT(quote,i_)<AUX778076_SPEC_NAME,Tag> |
1254 |
381 AUX778076_BIND_N_PARAMS(i_,T) |
1255 template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6> |
382 > |
1256 _bi::bind_t<R, F, typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type> |
383 { |
1257 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) |
384 template< |
1258 { |
385 AUX778076_BIND_NESTED_DEFAULT_PARAMS(typename U, na) |
1259 typedef typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type list_type; |
386 > |
1260 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6)); |
387 struct apply |
1261 } |
388 { |
1262 |
389 private: |
1263 template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7> |
390 typedef mpl::arg<1> n1; |
1264 _bi::bind_t<R, F, typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type> |
391 # define BOOST_PP_ITERATION_PARAMS_2 (3,(1, i_, <boost/mpl/bind.hpp>)) |
1265 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) |
392 # include BOOST_PP_ITERATE() |
1266 { |
393 |
1267 typedef typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type list_type; |
394 typedef typename AUX778076_SPEC_NAME< |
1268 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7)); |
395 typename t1::type |
1269 } |
396 , BOOST_MPL_PP_EXT_PARAMS(2, BOOST_PP_INC(i_), t) |
1270 |
397 >::type f_; |
1271 template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> |
398 |
1272 _bi::bind_t<R, F, typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type> |
399 public: |
1273 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) |
400 typedef typename f_::type type; |
1274 { |
401 }; |
1275 typedef typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type list_type; |
402 }; |
1276 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8)); |
403 |
1277 } |
404 #undef AUX778076_SPEC_NAME |
1278 |
405 |
1279 template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> |
406 #else // AUX778076_SPEC_NAME |
1280 _bi::bind_t<R, F, typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type> |
407 |
1281 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) |
408 template< |
1282 { |
409 typename F AUX778076_BIND_N_PARAMS(i_, typename T) AUX778076_DMC_PARAM() |
1283 typedef typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type list_type; |
410 > |
1284 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); |
411 struct BOOST_PP_CAT(bind,i_) |
1285 } |
412 { |
1286 |
413 template< |
1287 // generic function objects, alternative syntax |
414 AUX778076_BIND_NESTED_DEFAULT_PARAMS(typename U, na) |
1288 |
415 > |
1289 template<class R, class F> |
416 struct apply |
1290 _bi::bind_t<R, F, _bi::list0> |
417 { |
1291 BOOST_BIND(boost::type<R>, F f) |
418 private: |
1292 { |
419 # if !defined(BOOST_MPL_CFG_NO_UNNAMED_PLACEHOLDER_SUPPORT) |
1293 typedef _bi::list0 list_type; |
420 |
1294 return _bi::bind_t<R, F, list_type> (f, list_type()); |
421 typedef aux::replace_unnamed_arg< F,mpl::arg<1> > r0; |
1295 } |
422 typedef typename r0::type a0; |
1296 |
423 typedef typename r0::next n1; |
1297 template<class R, class F, class A1> |
424 typedef typename aux::resolve_bind_arg<a0,AUX778076_BIND_PARAMS(U)>::type f_; |
1298 _bi::bind_t<R, F, typename _bi::list_av_1<A1>::type> |
425 /// |
1299 BOOST_BIND(boost::type<R>, F f, A1 a1) |
426 # else |
1300 { |
427 typedef typename aux::resolve_bind_arg<F,AUX778076_BIND_PARAMS(U)>::type f_; |
1301 typedef typename _bi::list_av_1<A1>::type list_type; |
428 |
1302 return _bi::bind_t<R, F, list_type> (f, list_type(a1)); |
429 # endif // BOOST_MPL_CFG_NO_UNNAMED_PLACEHOLDER_SUPPORT |
1303 } |
430 |
1304 |
431 # if i_ > 0 |
1305 template<class R, class F, class A1, class A2> |
432 # define BOOST_PP_ITERATION_PARAMS_2 (3,(1, i_, <boost/mpl/bind.hpp>)) |
1306 _bi::bind_t<R, F, typename _bi::list_av_2<A1, A2>::type> |
433 # include BOOST_PP_ITERATE() |
1307 BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2) |
434 # endif |
1308 { |
435 |
1309 typedef typename _bi::list_av_2<A1, A2>::type list_type; |
436 public: |
1310 return _bi::bind_t<R, F, list_type> (f, list_type(a1, a2)); |
437 |
1311 } |
438 # define AUX778076_ARG(unused, i_, t) \ |
1312 |
439 BOOST_PP_COMMA_IF(i_) \ |
1313 template<class R, class F, class A1, class A2, class A3> |
440 typename BOOST_PP_CAT(t,BOOST_PP_INC(i_))::type \ |
1314 _bi::bind_t<R, F, typename _bi::list_av_3<A1, A2, A3>::type> |
441 /**/ |
1315 BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3) |
442 |
1316 { |
443 typedef typename BOOST_PP_CAT(apply_wrap,i_)< |
1317 typedef typename _bi::list_av_3<A1, A2, A3>::type list_type; |
444 f_ |
1318 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3)); |
445 BOOST_PP_COMMA_IF(i_) BOOST_MPL_PP_REPEAT(i_, AUX778076_ARG, t) |
1319 } |
446 >::type type; |
1320 |
447 |
1321 template<class R, class F, class A1, class A2, class A3, class A4> |
448 # undef AUX778076_ARG |
1322 _bi::bind_t<R, F, typename _bi::list_av_4<A1, A2, A3, A4>::type> |
449 }; |
1323 BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3, A4 a4) |
450 }; |
1324 { |
451 |
1325 typedef typename _bi::list_av_4<A1, A2, A3, A4>::type list_type; |
452 namespace aux { |
1326 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4)); |
453 |
1327 } |
454 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) |
1328 |
455 |
1329 template<class R, class F, class A1, class A2, class A3, class A4, class A5> |
456 template< |
1330 _bi::bind_t<R, F, typename _bi::list_av_5<A1, A2, A3, A4, A5>::type> |
457 typename F AUX778076_BIND_N_PARAMS(i_, typename T), AUX778076_BIND_PARAMS(typename U) |
1331 BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) |
458 > |
1332 { |
459 struct resolve_bind_arg< |
1333 typedef typename _bi::list_av_5<A1, A2, A3, A4, A5>::type list_type; |
460 BOOST_PP_CAT(bind,i_)<F AUX778076_BIND_N_PARAMS(i_,T)>,AUX778076_BIND_PARAMS(U) |
1334 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5)); |
461 > |
1335 } |
462 { |
1336 |
463 typedef BOOST_PP_CAT(bind,i_)<F AUX778076_BIND_N_PARAMS(i_,T)> f_; |
1337 template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6> |
464 typedef typename AUX778076_APPLY<f_, AUX778076_BIND_PARAMS(U)>::type type; |
1338 _bi::bind_t<R, F, typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type> |
465 }; |
1339 BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) |
|
1340 { |
|
1341 typedef typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type list_type; |
|
1342 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6)); |
|
1343 } |
|
1344 |
|
1345 template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7> |
|
1346 _bi::bind_t<R, F, typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type> |
|
1347 BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) |
|
1348 { |
|
1349 typedef typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type list_type; |
|
1350 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7)); |
|
1351 } |
|
1352 |
|
1353 template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> |
|
1354 _bi::bind_t<R, F, typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type> |
|
1355 BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) |
|
1356 { |
|
1357 typedef typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type list_type; |
|
1358 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8)); |
|
1359 } |
|
1360 |
|
1361 template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> |
|
1362 _bi::bind_t<R, F, typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type> |
|
1363 BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) |
|
1364 { |
|
1365 typedef typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type list_type; |
|
1366 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); |
|
1367 } |
|
1368 |
|
1369 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) |
|
1370 |
|
1371 // adaptable function objects |
|
1372 |
|
1373 template<class F> |
|
1374 _bi::bind_t<_bi::unspecified, F, _bi::list0> |
|
1375 BOOST_BIND(F f) |
|
1376 { |
|
1377 typedef _bi::list0 list_type; |
|
1378 return _bi::bind_t<_bi::unspecified, F, list_type> (f, list_type()); |
|
1379 } |
|
1380 |
|
1381 template<class F, class A1> |
|
1382 _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_1<A1>::type> |
|
1383 BOOST_BIND(F f, A1 a1) |
|
1384 { |
|
1385 typedef typename _bi::list_av_1<A1>::type list_type; |
|
1386 return _bi::bind_t<_bi::unspecified, F, list_type> (f, list_type(a1)); |
|
1387 } |
|
1388 |
|
1389 template<class F, class A1, class A2> |
|
1390 _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_2<A1, A2>::type> |
|
1391 BOOST_BIND(F f, A1 a1, A2 a2) |
|
1392 { |
|
1393 typedef typename _bi::list_av_2<A1, A2>::type list_type; |
|
1394 return _bi::bind_t<_bi::unspecified, F, list_type> (f, list_type(a1, a2)); |
|
1395 } |
|
1396 |
|
1397 template<class F, class A1, class A2, class A3> |
|
1398 _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_3<A1, A2, A3>::type> |
|
1399 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3) |
|
1400 { |
|
1401 typedef typename _bi::list_av_3<A1, A2, A3>::type list_type; |
|
1402 return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3)); |
|
1403 } |
|
1404 |
|
1405 template<class F, class A1, class A2, class A3, class A4> |
|
1406 _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_4<A1, A2, A3, A4>::type> |
|
1407 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4) |
|
1408 { |
|
1409 typedef typename _bi::list_av_4<A1, A2, A3, A4>::type list_type; |
|
1410 return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4)); |
|
1411 } |
|
1412 |
|
1413 template<class F, class A1, class A2, class A3, class A4, class A5> |
|
1414 _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_5<A1, A2, A3, A4, A5>::type> |
|
1415 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) |
|
1416 { |
|
1417 typedef typename _bi::list_av_5<A1, A2, A3, A4, A5>::type list_type; |
|
1418 return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5)); |
|
1419 } |
|
1420 |
|
1421 template<class F, class A1, class A2, class A3, class A4, class A5, class A6> |
|
1422 _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type> |
|
1423 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) |
|
1424 { |
|
1425 typedef typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type list_type; |
|
1426 return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6)); |
|
1427 } |
|
1428 |
|
1429 template<class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7> |
|
1430 _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type> |
|
1431 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) |
|
1432 { |
|
1433 typedef typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type list_type; |
|
1434 return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7)); |
|
1435 } |
|
1436 |
|
1437 template<class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> |
|
1438 _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type> |
|
1439 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) |
|
1440 { |
|
1441 typedef typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type list_type; |
|
1442 return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8)); |
|
1443 } |
|
1444 |
|
1445 template<class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> |
|
1446 _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type> |
|
1447 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) |
|
1448 { |
|
1449 typedef typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type list_type; |
|
1450 return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); |
|
1451 } |
|
1452 |
|
1453 #endif // !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) |
|
1454 |
|
1455 // function pointers |
|
1456 |
|
1457 #define BOOST_BIND_CC |
|
1458 #define BOOST_BIND_ST |
|
1459 |
|
1460 #include <boost/bind/bind_cc.hpp> |
|
1461 |
|
1462 #undef BOOST_BIND_CC |
|
1463 #undef BOOST_BIND_ST |
|
1464 |
|
1465 #ifdef BOOST_BIND_ENABLE_STDCALL |
|
1466 |
|
1467 #define BOOST_BIND_CC __stdcall |
|
1468 #define BOOST_BIND_ST |
|
1469 |
|
1470 #include <boost/bind/bind_cc.hpp> |
|
1471 |
|
1472 #undef BOOST_BIND_CC |
|
1473 #undef BOOST_BIND_ST |
|
1474 |
|
1475 #endif |
|
1476 |
|
1477 #ifdef BOOST_BIND_ENABLE_FASTCALL |
|
1478 |
|
1479 #define BOOST_BIND_CC __fastcall |
|
1480 #define BOOST_BIND_ST |
|
1481 |
|
1482 #include <boost/bind/bind_cc.hpp> |
|
1483 |
|
1484 #undef BOOST_BIND_CC |
|
1485 #undef BOOST_BIND_ST |
|
1486 |
|
1487 #endif |
|
1488 |
|
1489 #ifdef BOOST_BIND_ENABLE_PASCAL |
|
1490 |
|
1491 #define BOOST_BIND_ST pascal |
|
1492 #define BOOST_BIND_CC |
|
1493 |
|
1494 #include <boost/bind/bind_cc.hpp> |
|
1495 |
|
1496 #undef BOOST_BIND_ST |
|
1497 #undef BOOST_BIND_CC |
|
1498 |
|
1499 #endif |
|
1500 |
|
1501 // member function pointers |
|
1502 |
|
1503 #define BOOST_BIND_MF_NAME(X) X |
|
1504 #define BOOST_BIND_MF_CC |
|
1505 |
|
1506 #include <boost/bind/bind_mf_cc.hpp> |
|
1507 |
|
1508 #undef BOOST_BIND_MF_NAME |
|
1509 #undef BOOST_BIND_MF_CC |
|
1510 |
|
1511 #ifdef BOOST_MEM_FN_ENABLE_CDECL |
|
1512 |
|
1513 #define BOOST_BIND_MF_NAME(X) X##_cdecl |
|
1514 #define BOOST_BIND_MF_CC __cdecl |
|
1515 |
|
1516 #include <boost/bind/bind_mf_cc.hpp> |
|
1517 |
|
1518 #undef BOOST_BIND_MF_NAME |
|
1519 #undef BOOST_BIND_MF_CC |
|
1520 |
|
1521 #endif |
|
1522 |
|
1523 #ifdef BOOST_MEM_FN_ENABLE_STDCALL |
|
1524 |
|
1525 #define BOOST_BIND_MF_NAME(X) X##_stdcall |
|
1526 #define BOOST_BIND_MF_CC __stdcall |
|
1527 |
|
1528 #include <boost/bind/bind_mf_cc.hpp> |
|
1529 |
|
1530 #undef BOOST_BIND_MF_NAME |
|
1531 #undef BOOST_BIND_MF_CC |
|
1532 |
|
1533 #endif |
|
1534 |
|
1535 #ifdef BOOST_MEM_FN_ENABLE_FASTCALL |
|
1536 |
|
1537 #define BOOST_BIND_MF_NAME(X) X##_fastcall |
|
1538 #define BOOST_BIND_MF_CC __fastcall |
|
1539 |
|
1540 #include <boost/bind/bind_mf_cc.hpp> |
|
1541 |
|
1542 #undef BOOST_BIND_MF_NAME |
|
1543 #undef BOOST_BIND_MF_CC |
|
1544 |
|
1545 #endif |
|
1546 |
|
1547 // data member pointers |
|
1548 |
|
1549 #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) || defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ |
|
1550 || ( defined(__BORLANDC__) && BOOST_WORKAROUND( __BORLANDC__, < 0x600 ) ) |
|
1551 |
|
1552 template<class R, class T, class A1> |
|
1553 _bi::bind_t< R, _mfi::dm<R, T>, typename _bi::list_av_1<A1>::type > |
|
1554 BOOST_BIND(R T::*f, A1 a1) |
|
1555 { |
|
1556 typedef _mfi::dm<R, T> F; |
|
1557 typedef typename _bi::list_av_1<A1>::type list_type; |
|
1558 return _bi::bind_t<R, F, list_type>( F(f), list_type(a1) ); |
|
1559 } |
466 |
1560 |
467 #else |
1561 #else |
468 |
1562 |
469 template< |
1563 namespace _bi |
470 typename F AUX778076_BIND_N_PARAMS(i_, typename T) |
1564 { |
471 > |
1565 |
472 aux::yes_tag |
1566 template< class Pm, int I > struct add_cref; |
473 is_bind_helper(BOOST_PP_CAT(bind,i_)<F AUX778076_BIND_N_PARAMS(i_,T)>*); |
1567 |
474 |
1568 template< class M, class T > struct add_cref< M T::*, 0 > |
475 #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION |
1569 { |
476 |
1570 typedef M type; |
477 } // namespace aux |
1571 }; |
478 |
1572 |
479 BOOST_MPL_AUX_ARITY_SPEC(BOOST_PP_INC(i_), BOOST_PP_CAT(bind,i_)) |
1573 template< class M, class T > struct add_cref< M T::*, 1 > |
480 BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(BOOST_PP_INC(i_), BOOST_PP_CAT(bind,i_)) |
1574 { |
481 |
1575 typedef M const & type; |
482 # if !defined(BOOST_MPL_CFG_NO_BIND_TEMPLATE) |
1576 }; |
483 # if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) |
1577 |
484 |
1578 template< class R, class T > struct add_cref< R (T::*) (), 1 > |
485 #if i_ == BOOST_MPL_LIMIT_METAFUNCTION_ARITY |
1579 { |
486 /// primary template (not a specialization!) |
1580 typedef void type; |
487 template< |
1581 }; |
488 typename F AUX778076_BIND_N_PARAMS(i_, typename T) AUX778076_DMC_PARAM() |
1582 |
489 > |
1583 #if !( defined(__IBMCPP__) && BOOST_WORKAROUND( __IBMCPP__, BOOST_TESTED_AT(600) ) ) |
490 struct bind |
1584 |
491 : BOOST_PP_CAT(bind,i_)<F AUX778076_BIND_N_PARAMS(i_,T) > |
1585 template< class R, class T > struct add_cref< R (T::*) () const, 1 > |
492 { |
1586 { |
493 }; |
1587 typedef void type; |
494 #else |
1588 }; |
495 template< |
1589 |
496 typename F AUX778076_BIND_N_PARAMS(i_, typename T) AUX778076_DMC_PARAM() |
1590 #endif // __IBMCPP__ |
497 > |
1591 |
498 struct bind< F AUX778076_BIND_N_SPEC_PARAMS(i_, T, na) > |
1592 template<class R> struct isref |
499 : BOOST_PP_CAT(bind,i_)<F AUX778076_BIND_N_PARAMS(i_,T) > |
1593 { |
500 { |
1594 enum value_type { value = 0 }; |
501 }; |
1595 }; |
502 #endif |
1596 |
503 |
1597 template<class R> struct isref< R& > |
504 # else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION |
1598 { |
505 |
1599 enum value_type { value = 1 }; |
506 namespace aux { |
1600 }; |
507 |
1601 |
508 template<> |
1602 template<class R> struct isref< R* > |
509 struct bind_chooser<i_> |
1603 { |
510 { |
1604 enum value_type { value = 1 }; |
511 template< |
1605 }; |
512 typename F, AUX778076_BIND_PARAMS(typename T) |
1606 |
513 > |
1607 template<class Pm, class A1> struct dm_result |
514 struct result_ |
1608 { |
515 { |
1609 typedef typename add_cref< Pm, 1 >::type type; |
516 typedef BOOST_PP_CAT(bind,i_)< F AUX778076_BIND_N_PARAMS(i_,T) > type; |
1610 }; |
517 }; |
1611 |
518 }; |
1612 template<class Pm, class R, class F, class L> struct dm_result< Pm, bind_t<R, F, L> > |
519 |
1613 { |
520 } // namespace aux |
1614 typedef typename bind_t<R, F, L>::result_type result_type; |
521 |
1615 typedef typename add_cref< Pm, isref< result_type >::value >::type type; |
522 # endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION |
1616 }; |
523 # endif // BOOST_MPL_CFG_NO_BIND_TEMPLATE |
1617 |
524 |
1618 } // namespace _bi |
525 #endif // AUX778076_SPEC_NAME |
1619 |
526 |
1620 template< class A1, class M, class T > |
527 # undef i_ |
1621 |
528 |
1622 _bi::bind_t< |
529 ///// iteration, depth == 2 |
1623 typename _bi::dm_result< M T::*, A1 >::type, |
530 |
1624 _mfi::dm<M, T>, |
531 #elif BOOST_PP_ITERATION_DEPTH() == 2 |
1625 typename _bi::list_av_1<A1>::type |
532 |
1626 > |
533 # define j_ BOOST_PP_FRAME_ITERATION(2) |
1627 |
534 # if !defined(BOOST_MPL_CFG_NO_UNNAMED_PLACEHOLDER_SUPPORT) |
1628 BOOST_BIND( M T::*f, A1 a1 ) |
535 |
1629 { |
536 typedef aux::replace_unnamed_arg< BOOST_PP_CAT(T,j_),BOOST_PP_CAT(n,j_) > BOOST_PP_CAT(r,j_); |
1630 typedef typename _bi::dm_result< M T::*, A1 >::type result_type; |
537 typedef typename BOOST_PP_CAT(r,j_)::type BOOST_PP_CAT(a,j_); |
1631 typedef _mfi::dm<M, T> F; |
538 typedef typename BOOST_PP_CAT(r,j_)::next BOOST_PP_CAT(n,BOOST_PP_INC(j_)); |
1632 typedef typename _bi::list_av_1<A1>::type list_type; |
539 typedef aux::resolve_bind_arg<BOOST_PP_CAT(a,j_), AUX778076_BIND_PARAMS(U)> BOOST_PP_CAT(t,j_); |
1633 return _bi::bind_t< result_type, F, list_type >( F( f ), list_type( a1 ) ); |
540 /// |
1634 } |
541 # else |
1635 |
542 typedef aux::resolve_bind_arg< BOOST_PP_CAT(T,j_),AUX778076_BIND_PARAMS(U)> BOOST_PP_CAT(t,j_); |
1636 #endif |
543 |
1637 |
544 # endif |
1638 } // namespace boost |
545 # undef j_ |
1639 |
546 |
1640 #ifndef BOOST_BIND_NO_PLACEHOLDERS |
547 #endif // BOOST_PP_IS_ITERATING |
1641 |
|
1642 # include <boost/bind/placeholders.hpp> |
|
1643 |
|
1644 #endif |
|
1645 |
|
1646 #ifdef BOOST_MSVC |
|
1647 # pragma warning(default: 4512) // assignment operator could not be generated |
|
1648 # pragma warning(pop) |
|
1649 #endif |
|
1650 |
|
1651 #endif // #ifndef BOOST_BIND_HPP_INCLUDED |