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