1#ifndef BOOST_BIND_BIND_HPP_INCLUDED
2#define BOOST_BIND_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/bind/detail/requires_cxx11.hpp>
25#include <boost/config.hpp>
26#include <boost/bind/mem_fn.hpp>
27#include <boost/type.hpp>
28#include <boost/is_placeholder.hpp>
29#include <boost/bind/arg.hpp>
30#include <boost/bind/detail/result_traits.hpp>
31#include <boost/bind/std_placeholders.hpp>
32#include <boost/config/workaround.hpp>
33#include <boost/visit_each.hpp>
34#include <boost/core/ref.hpp>
35#include <boost/core/enable_if.hpp>
36#include <boost/bind/detail/is_same.hpp>
37
38#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
39#include <utility> // std::forward
40#endif
41
42// Borland-specific bug, visit_each() silently fails to produce code
43
44#if defined(BOOST_BORLANDC)
45# define BOOST_BIND_VISIT_EACH boost::visit_each
46#else
47# define BOOST_BIND_VISIT_EACH visit_each
48#endif
49
50#include <boost/bind/storage.hpp>
51
52#ifdef BOOST_MSVC
53# pragma warning(push)
54# pragma warning(disable: 4512) // assignment operator could not be generated
55#endif
56
57namespace boost
58{
59
60template<class T> class weak_ptr;
61
62namespace _bi // implementation details
63{
64
65// ref_compare
66
67template<class T> bool ref_compare( T const & a, T const & b, long )
68{
69 return a == b;
70}
71
72template<int I> bool ref_compare( arg<I> const &, arg<I> const &, int )
73{
74 return true;
75}
76
77template<int I> bool ref_compare( arg<I> (*) (), arg<I> (*) (), int )
78{
79 return true;
80}
81
82template<class T> bool ref_compare( reference_wrapper<T> const & a, reference_wrapper<T> const & b, int )
83{
84 return a.get_pointer() == b.get_pointer();
85}
86
87// bind_t forward declaration for listN
88
89template<class R, class F, class L> class bind_t;
90
91template<class R, class F, class L> bool ref_compare( bind_t<R, F, L> const & a, bind_t<R, F, L> const & b, int )
92{
93 return a.compare( b );
94}
95
96// value
97
98template<class T> class value
99{
100public:
101
102 value(T const & t): t_(t) {}
103
104 T & get() { return t_; }
105 T const & get() const { return t_; }
106
107 bool operator==(value const & rhs) const
108 {
109 return t_ == rhs.t_;
110 }
111
112private:
113
114 T t_;
115};
116
117// ref_compare for weak_ptr
118
119template<class T> bool ref_compare( value< weak_ptr<T> > const & a, value< weak_ptr<T> > const & b, int )
120{
121 return !(a.get() < b.get()) && !(b.get() < a.get());
122}
123
124// type
125
126template<class T> class type {};
127
128// unwrap
129
130template<class F> struct unwrapper
131{
132 static inline F & unwrap( F & f, long )
133 {
134 return f;
135 }
136
137 template<class F2> static inline F2 & unwrap( reference_wrapper<F2> rf, int )
138 {
139 return rf.get();
140 }
141
142 template<class R, class T> static inline _mfi::dm<R, T> unwrap( R T::* pm, int )
143 {
144 return _mfi::dm<R, T>( pm );
145 }
146};
147
148// listN
149
150class list0
151{
152public:
153
154 list0() {}
155
156 template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
157
158 template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
159
160 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
161
162 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); }
163
164 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); }
165
166 template<class R, class F, class A> R operator()(type<R>, F & f, A &, long)
167 {
168 return unwrapper<F>::unwrap(f, 0)();
169 }
170
171 template<class R, class F, class A> R operator()(type<R>, F const & f, A &, long) const
172 {
173 return unwrapper<F const>::unwrap(f, 0)();
174 }
175
176 template<class F, class A> void operator()(type<void>, F & f, A &, int)
177 {
178 unwrapper<F>::unwrap(f, 0)();
179 }
180
181 template<class F, class A> void operator()(type<void>, F const & f, A &, int) const
182 {
183 unwrapper<F const>::unwrap(f, 0)();
184 }
185
186 template<class V> void accept(V &) const
187 {
188 }
189
190 bool operator==(list0 const &) const
191 {
192 return true;
193 }
194};
195
196#ifdef BOOST_MSVC
197// MSVC is bright enough to realise that the parameter rhs
198// in operator==may be unused for some template argument types:
199#pragma warning(push)
200#pragma warning(disable:4100)
201#endif
202
203template< class A1 > class list1: private storage1< A1 >
204{
205private:
206
207 typedef storage1< A1 > base_type;
208
209public:
210
211 explicit list1( A1 a1 ): base_type( a1 ) {}
212
213 A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
214
215 A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
216
217 template<class T> T & operator[] ( _bi::value<T> & v ) const { return v.get(); }
218
219 template<class T> T const & operator[] ( _bi::value<T> const & v ) const { return v.get(); }
220
221 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
222
223 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); }
224
225 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); }
226
227 template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
228 {
229 return unwrapper<F>::unwrap(f, 0)(a[base_type::a1_]);
230 }
231
232 template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
233 {
234 return unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_]);
235 }
236
237 template<class F, class A> void operator()(type<void>, F & f, A & a, int)
238 {
239 unwrapper<F>::unwrap(f, 0)(a[base_type::a1_]);
240 }
241
242 template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
243 {
244 unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_]);
245 }
246
247 template<class V> void accept(V & v) const
248 {
249 base_type::accept(v);
250 }
251
252 bool operator==(list1 const & rhs) const
253 {
254 return ref_compare(base_type::a1_, rhs.a1_, 0);
255 }
256};
257
258struct logical_and;
259struct logical_or;
260
261template< class A1, class A2 > class list2: private storage2< A1, A2 >
262{
263private:
264
265 typedef storage2< A1, A2 > base_type;
266
267public:
268
269 list2( A1 a1, A2 a2 ): base_type( a1, a2 ) {}
270
271 A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
272 A2 operator[] (boost::arg<2>) const { return base_type::a2_; }
273
274 A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
275 A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; }
276
277 template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
278
279 template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
280
281 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
282
283 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); }
284
285 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); }
286
287 template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
288 {
289 return unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]);
290 }
291
292 template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
293 {
294 return unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]);
295 }
296
297 template<class F, class A> void operator()(type<void>, F & f, A & a, int)
298 {
299 unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]);
300 }
301
302 template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
303 {
304 unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]);
305 }
306
307 template<class A> bool operator()( type<bool>, logical_and & /*f*/, A & a, int )
308 {
309 return a[ base_type::a1_ ] && a[ base_type::a2_ ];
310 }
311
312 template<class A> bool operator()( type<bool>, logical_and const & /*f*/, A & a, int ) const
313 {
314 return a[ base_type::a1_ ] && a[ base_type::a2_ ];
315 }
316
317 template<class A> bool operator()( type<bool>, logical_or & /*f*/, A & a, int )
318 {
319 return a[ base_type::a1_ ] || a[ base_type::a2_ ];
320 }
321
322 template<class A> bool operator()( type<bool>, logical_or const & /*f*/, A & a, int ) const
323 {
324 return a[ base_type::a1_ ] || a[ base_type::a2_ ];
325 }
326
327 template<class V> void accept(V & v) const
328 {
329 base_type::accept(v);
330 }
331
332 bool operator==(list2 const & rhs) const
333 {
334 return ref_compare(base_type::a1_, rhs.a1_, 0) && ref_compare(base_type::a2_, rhs.a2_, 0);
335 }
336};
337
338template< class A1, class A2, class A3 > class list3: private storage3< A1, A2, A3 >
339{
340private:
341
342 typedef storage3< A1, A2, A3 > base_type;
343
344public:
345
346 list3( A1 a1, A2 a2, A3 a3 ): base_type( a1, a2, a3 ) {}
347
348 A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
349 A2 operator[] (boost::arg<2>) const { return base_type::a2_; }
350 A3 operator[] (boost::arg<3>) const { return base_type::a3_; }
351
352 A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
353 A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; }
354 A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; }
355
356 template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
357
358 template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
359
360 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
361
362 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); }
363
364 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); }
365
366 template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
367 {
368 return unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]);
369 }
370
371 template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
372 {
373 return unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]);
374 }
375
376 template<class F, class A> void operator()(type<void>, F & f, A & a, int)
377 {
378 unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]);
379 }
380
381 template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
382 {
383 unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]);
384 }
385
386 template<class V> void accept(V & v) const
387 {
388 base_type::accept(v);
389 }
390
391 bool operator==(list3 const & rhs) const
392 {
393 return
394
395 ref_compare( base_type::a1_, rhs.a1_, 0 ) &&
396 ref_compare( base_type::a2_, rhs.a2_, 0 ) &&
397 ref_compare( base_type::a3_, rhs.a3_, 0 );
398 }
399};
400
401template< class A1, class A2, class A3, class A4 > class list4: private storage4< A1, A2, A3, A4 >
402{
403private:
404
405 typedef storage4< A1, A2, A3, A4 > base_type;
406
407public:
408
409 list4( A1 a1, A2 a2, A3 a3, A4 a4 ): base_type( a1, a2, a3, a4 ) {}
410
411 A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
412 A2 operator[] (boost::arg<2>) const { return base_type::a2_; }
413 A3 operator[] (boost::arg<3>) const { return base_type::a3_; }
414 A4 operator[] (boost::arg<4>) const { return base_type::a4_; }
415
416 A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
417 A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; }
418 A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; }
419 A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; }
420
421 template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
422
423 template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
424
425 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
426
427 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); }
428
429 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); }
430
431 template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
432 {
433 return unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]);
434 }
435
436 template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
437 {
438 return unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]);
439 }
440
441 template<class F, class A> void operator()(type<void>, F & f, A & a, int)
442 {
443 unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]);
444 }
445
446 template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
447 {
448 unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]);
449 }
450
451 template<class V> void accept(V & v) const
452 {
453 base_type::accept(v);
454 }
455
456 bool operator==(list4 const & rhs) const
457 {
458 return
459
460 ref_compare( base_type::a1_, rhs.a1_, 0 ) &&
461 ref_compare( base_type::a2_, rhs.a2_, 0 ) &&
462 ref_compare( base_type::a3_, rhs.a3_, 0 ) &&
463 ref_compare( base_type::a4_, rhs.a4_, 0 );
464 }
465};
466
467template< class A1, class A2, class A3, class A4, class A5 > class list5: private storage5< A1, A2, A3, A4, A5 >
468{
469private:
470
471 typedef storage5< A1, A2, A3, A4, A5 > base_type;
472
473public:
474
475 list5( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5 ): base_type( a1, a2, a3, a4, a5 ) {}
476
477 A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
478 A2 operator[] (boost::arg<2>) const { return base_type::a2_; }
479 A3 operator[] (boost::arg<3>) const { return base_type::a3_; }
480 A4 operator[] (boost::arg<4>) const { return base_type::a4_; }
481 A5 operator[] (boost::arg<5>) const { return base_type::a5_; }
482
483 A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
484 A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; }
485 A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; }
486 A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; }
487 A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; }
488
489 template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
490
491 template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
492
493 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
494
495 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); }
496
497 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); }
498
499 template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
500 {
501 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_]);
502 }
503
504 template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
505 {
506 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_]);
507 }
508
509 template<class F, class A> void operator()(type<void>, F & f, A & a, int)
510 {
511 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_]);
512 }
513
514 template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
515 {
516 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_]);
517 }
518
519 template<class V> void accept(V & v) const
520 {
521 base_type::accept(v);
522 }
523
524 bool operator==(list5 const & rhs) const
525 {
526 return
527
528 ref_compare( base_type::a1_, rhs.a1_, 0 ) &&
529 ref_compare( base_type::a2_, rhs.a2_, 0 ) &&
530 ref_compare( base_type::a3_, rhs.a3_, 0 ) &&
531 ref_compare( base_type::a4_, rhs.a4_, 0 ) &&
532 ref_compare( base_type::a5_, rhs.a5_, 0 );
533 }
534};
535
536template<class A1, class A2, class A3, class A4, class A5, class A6> class list6: private storage6< A1, A2, A3, A4, A5, A6 >
537{
538private:
539
540 typedef storage6< A1, A2, A3, A4, A5, A6 > base_type;
541
542public:
543
544 list6( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6 ): base_type( a1, a2, a3, a4, a5, a6 ) {}
545
546 A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
547 A2 operator[] (boost::arg<2>) const { return base_type::a2_; }
548 A3 operator[] (boost::arg<3>) const { return base_type::a3_; }
549 A4 operator[] (boost::arg<4>) const { return base_type::a4_; }
550 A5 operator[] (boost::arg<5>) const { return base_type::a5_; }
551 A6 operator[] (boost::arg<6>) const { return base_type::a6_; }
552
553 A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
554 A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; }
555 A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; }
556 A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; }
557 A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; }
558 A6 operator[] (boost::arg<6> (*) ()) const { return base_type::a6_; }
559
560 template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
561
562 template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
563
564 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
565
566 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); }
567
568 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); }
569
570 template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
571 {
572 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_]);
573 }
574
575 template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
576 {
577 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_]);
578 }
579
580 template<class F, class A> void operator()(type<void>, F & f, A & a, int)
581 {
582 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_]);
583 }
584
585 template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
586 {
587 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_]);
588 }
589
590 template<class V> void accept(V & v) const
591 {
592 base_type::accept(v);
593 }
594
595 bool operator==(list6 const & rhs) const
596 {
597 return
598
599 ref_compare( base_type::a1_, rhs.a1_, 0 ) &&
600 ref_compare( base_type::a2_, rhs.a2_, 0 ) &&
601 ref_compare( base_type::a3_, rhs.a3_, 0 ) &&
602 ref_compare( base_type::a4_, rhs.a4_, 0 ) &&
603 ref_compare( base_type::a5_, rhs.a5_, 0 ) &&
604 ref_compare( base_type::a6_, rhs.a6_, 0 );
605 }
606};
607
608template<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 >
609{
610private:
611
612 typedef storage7< A1, A2, A3, A4, A5, A6, A7 > base_type;
613
614public:
615
616 list7( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7 ): base_type( a1, a2, a3, a4, a5, a6, a7 ) {}
617
618 A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
619 A2 operator[] (boost::arg<2>) const { return base_type::a2_; }
620 A3 operator[] (boost::arg<3>) const { return base_type::a3_; }
621 A4 operator[] (boost::arg<4>) const { return base_type::a4_; }
622 A5 operator[] (boost::arg<5>) const { return base_type::a5_; }
623 A6 operator[] (boost::arg<6>) const { return base_type::a6_; }
624 A7 operator[] (boost::arg<7>) const { return base_type::a7_; }
625
626 A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
627 A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; }
628 A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; }
629 A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; }
630 A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; }
631 A6 operator[] (boost::arg<6> (*) ()) const { return base_type::a6_; }
632 A7 operator[] (boost::arg<7> (*) ()) const { return base_type::a7_; }
633
634 template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
635
636 template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
637
638 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
639
640 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); }
641
642 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); }
643
644 template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
645 {
646 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_]);
647 }
648
649 template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
650 {
651 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_]);
652 }
653
654 template<class F, class A> void operator()(type<void>, F & f, A & a, int)
655 {
656 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_]);
657 }
658
659 template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
660 {
661 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_]);
662 }
663
664 template<class V> void accept(V & v) const
665 {
666 base_type::accept(v);
667 }
668
669 bool operator==(list7 const & rhs) const
670 {
671 return
672
673 ref_compare( base_type::a1_, rhs.a1_, 0 ) &&
674 ref_compare( base_type::a2_, rhs.a2_, 0 ) &&
675 ref_compare( base_type::a3_, rhs.a3_, 0 ) &&
676 ref_compare( base_type::a4_, rhs.a4_, 0 ) &&
677 ref_compare( base_type::a5_, rhs.a5_, 0 ) &&
678 ref_compare( base_type::a6_, rhs.a6_, 0 ) &&
679 ref_compare( base_type::a7_, rhs.a7_, 0 );
680 }
681};
682
683template< 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 >
684{
685private:
686
687 typedef storage8< A1, A2, A3, A4, A5, A6, A7, A8 > base_type;
688
689public:
690
691 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 ) {}
692
693 A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
694 A2 operator[] (boost::arg<2>) const { return base_type::a2_; }
695 A3 operator[] (boost::arg<3>) const { return base_type::a3_; }
696 A4 operator[] (boost::arg<4>) const { return base_type::a4_; }
697 A5 operator[] (boost::arg<5>) const { return base_type::a5_; }
698 A6 operator[] (boost::arg<6>) const { return base_type::a6_; }
699 A7 operator[] (boost::arg<7>) const { return base_type::a7_; }
700 A8 operator[] (boost::arg<8>) const { return base_type::a8_; }
701
702 A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
703 A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; }
704 A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; }
705 A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; }
706 A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; }
707 A6 operator[] (boost::arg<6> (*) ()) const { return base_type::a6_; }
708 A7 operator[] (boost::arg<7> (*) ()) const { return base_type::a7_; }
709 A8 operator[] (boost::arg<8> (*) ()) const { return base_type::a8_; }
710
711 template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
712
713 template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
714
715 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
716
717 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); }
718
719 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); }
720
721 template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
722 {
723 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_]);
724 }
725
726 template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
727 {
728 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_]);
729 }
730
731 template<class F, class A> void operator()(type<void>, F & f, A & a, int)
732 {
733 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_]);
734 }
735
736 template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
737 {
738 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_]);
739 }
740
741 template<class V> void accept(V & v) const
742 {
743 base_type::accept(v);
744 }
745
746 bool operator==(list8 const & rhs) const
747 {
748 return
749
750 ref_compare( base_type::a1_, rhs.a1_, 0 ) &&
751 ref_compare( base_type::a2_, rhs.a2_, 0 ) &&
752 ref_compare( base_type::a3_, rhs.a3_, 0 ) &&
753 ref_compare( base_type::a4_, rhs.a4_, 0 ) &&
754 ref_compare( base_type::a5_, rhs.a5_, 0 ) &&
755 ref_compare( base_type::a6_, rhs.a6_, 0 ) &&
756 ref_compare( base_type::a7_, rhs.a7_, 0 ) &&
757 ref_compare( base_type::a8_, rhs.a8_, 0 );
758 }
759};
760
761template<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 >
762{
763private:
764
765 typedef storage9< A1, A2, A3, A4, A5, A6, A7, A8, A9 > base_type;
766
767public:
768
769 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 ) {}
770
771 A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
772 A2 operator[] (boost::arg<2>) const { return base_type::a2_; }
773 A3 operator[] (boost::arg<3>) const { return base_type::a3_; }
774 A4 operator[] (boost::arg<4>) const { return base_type::a4_; }
775 A5 operator[] (boost::arg<5>) const { return base_type::a5_; }
776 A6 operator[] (boost::arg<6>) const { return base_type::a6_; }
777 A7 operator[] (boost::arg<7>) const { return base_type::a7_; }
778 A8 operator[] (boost::arg<8>) const { return base_type::a8_; }
779 A9 operator[] (boost::arg<9>) const { return base_type::a9_; }
780
781 A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
782 A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; }
783 A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; }
784 A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; }
785 A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; }
786 A6 operator[] (boost::arg<6> (*) ()) const { return base_type::a6_; }
787 A7 operator[] (boost::arg<7> (*) ()) const { return base_type::a7_; }
788 A8 operator[] (boost::arg<8> (*) ()) const { return base_type::a8_; }
789 A9 operator[] (boost::arg<9> (*) ()) const { return base_type::a9_; }
790
791 template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
792
793 template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
794
795 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
796
797 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); }
798
799 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); }
800
801 template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
802 {
803 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_]);
804 }
805
806 template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
807 {
808 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_]);
809 }
810
811 template<class F, class A> void operator()(type<void>, F & f, A & a, int)
812 {
813 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_]);
814 }
815
816 template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
817 {
818 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_]);
819 }
820
821 template<class V> void accept(V & v) const
822 {
823 base_type::accept(v);
824 }
825
826 bool operator==(list9 const & rhs) const
827 {
828 return
829
830 ref_compare( base_type::a1_, rhs.a1_, 0 ) &&
831 ref_compare( base_type::a2_, rhs.a2_, 0 ) &&
832 ref_compare( base_type::a3_, rhs.a3_, 0 ) &&
833 ref_compare( base_type::a4_, rhs.a4_, 0 ) &&
834 ref_compare( base_type::a5_, rhs.a5_, 0 ) &&
835 ref_compare( base_type::a6_, rhs.a6_, 0 ) &&
836 ref_compare( base_type::a7_, rhs.a7_, 0 ) &&
837 ref_compare( base_type::a8_, rhs.a8_, 0 ) &&
838 ref_compare( base_type::a9_, rhs.a9_, 0 );
839 }
840};
841
842#ifdef BOOST_MSVC
843#pragma warning(pop)
844#endif
845
846// bind_t
847
848#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !(defined(BOOST_GCC) && BOOST_GCC < 40600)
849
850template< class A1 > class rrlist1
851{
852private:
853
854 A1 & a1_; // not A1&& because of msvc-10.0
855
856public:
857
858 explicit rrlist1( A1 & a1 ): a1_( a1 ) {}
859
860 A1 && operator[] (boost::arg<1>) const { return std::forward<A1>( a1_ ); } // not static_cast because of g++ 4.9
861
862 A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward<A1>( a1_ ); }
863
864 template<class T> T & operator[] ( _bi::value<T> & v ) const { return v.get(); }
865
866 template<class T> T const & operator[] ( _bi::value<T> const & v ) const { return v.get(); }
867
868 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
869
870 template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const
871 {
872 rrlist1<A1&> a( a1_ );
873 return b.eval( a );
874 }
875
876 template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const
877 {
878 rrlist1<A1&> a( a1_ );
879 return b.eval( a );
880 }
881};
882
883template< class A1, class A2 > class rrlist2
884{
885private:
886
887 A1 & a1_;
888 A2 & a2_;
889
890public:
891
892 rrlist2( A1 & a1, A2 & a2 ): a1_( a1 ), a2_( a2 ) {}
893
894 A1 && operator[] (boost::arg<1>) const { return std::forward<A1>( a1_ ); }
895 A2 && operator[] (boost::arg<2>) const { return std::forward<A2>( a2_ ); }
896
897 A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward<A1>( a1_ ); }
898 A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward<A2>( a2_ ); }
899
900 template<class T> T & operator[] ( _bi::value<T> & v ) const { return v.get(); }
901
902 template<class T> T const & operator[] ( _bi::value<T> const & v ) const { return v.get(); }
903
904 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
905
906 template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const
907 {
908 rrlist2<A1&, A2&> a( a1_, a2_ );
909 return b.eval( a );
910 }
911
912 template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const
913 {
914 rrlist2<A1&, A2&> a( a1_, a2_ );
915 return b.eval( a );
916 }
917};
918
919template< class A1, class A2, class A3 > class rrlist3
920{
921private:
922
923 A1 & a1_;
924 A2 & a2_;
925 A3 & a3_;
926
927public:
928
929 rrlist3( A1 & a1, A2 & a2, A3 & a3 ): a1_( a1 ), a2_( a2 ), a3_( a3 ) {}
930
931 A1 && operator[] (boost::arg<1>) const { return std::forward<A1>( a1_ ); }
932 A2 && operator[] (boost::arg<2>) const { return std::forward<A2>( a2_ ); }
933 A3 && operator[] (boost::arg<3>) const { return std::forward<A3>( a3_ ); }
934
935 A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward<A1>( a1_ ); }
936 A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward<A2>( a2_ ); }
937 A3 && operator[] (boost::arg<3> (*) ()) const { return std::forward<A3>( a3_ ); }
938
939 template<class T> T & operator[] ( _bi::value<T> & v ) const { return v.get(); }
940
941 template<class T> T const & operator[] ( _bi::value<T> const & v ) const { return v.get(); }
942
943 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
944
945 template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const
946 {
947 rrlist3<A1&, A2&, A3&> a( a1_, a2_, a3_ );
948 return b.eval( a );
949 }
950
951 template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const
952 {
953 rrlist3<A1&, A2&, A3&> a( a1_, a2_, a3_ );
954 return b.eval( a );
955 }
956};
957
958template< class A1, class A2, class A3, class A4 > class rrlist4
959{
960private:
961
962 A1 & a1_;
963 A2 & a2_;
964 A3 & a3_;
965 A4 & a4_;
966
967public:
968
969 rrlist4( A1 & a1, A2 & a2, A3 & a3, A4 & a4 ): a1_( a1 ), a2_( a2 ), a3_( a3 ), a4_( a4 ) {}
970
971 A1 && operator[] (boost::arg<1>) const { return std::forward<A1>( a1_ ); }
972 A2 && operator[] (boost::arg<2>) const { return std::forward<A2>( a2_ ); }
973 A3 && operator[] (boost::arg<3>) const { return std::forward<A3>( a3_ ); }
974 A4 && operator[] (boost::arg<4>) const { return std::forward<A4>( a4_ ); }
975
976 A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward<A1>( a1_ ); }
977 A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward<A2>( a2_ ); }
978 A3 && operator[] (boost::arg<3> (*) ()) const { return std::forward<A3>( a3_ ); }
979 A4 && operator[] (boost::arg<4> (*) ()) const { return std::forward<A4>( a4_ ); }
980
981 template<class T> T & operator[] ( _bi::value<T> & v ) const { return v.get(); }
982
983 template<class T> T const & operator[] ( _bi::value<T> const & v ) const { return v.get(); }
984
985 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
986
987 template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const
988 {
989 rrlist4<A1&, A2&, A3&, A4&> a( a1_, a2_, a3_, a4_ );
990 return b.eval( a );
991 }
992
993 template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const
994 {
995 rrlist4<A1&, A2&, A3&, A4&> a( a1_, a2_, a3_, a4_ );
996 return b.eval( a );
997 }
998};
999
1000template< class A1, class A2, class A3, class A4, class A5 > class rrlist5
1001{
1002private:
1003
1004 A1 & a1_;
1005 A2 & a2_;
1006 A3 & a3_;
1007 A4 & a4_;
1008 A5 & a5_;
1009
1010public:
1011
1012 rrlist5( A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5 ): a1_( a1 ), a2_( a2 ), a3_( a3 ), a4_( a4 ), a5_( a5 ) {}
1013
1014 A1 && operator[] (boost::arg<1>) const { return std::forward<A1>( a1_ ); }
1015 A2 && operator[] (boost::arg<2>) const { return std::forward<A2>( a2_ ); }
1016 A3 && operator[] (boost::arg<3>) const { return std::forward<A3>( a3_ ); }
1017 A4 && operator[] (boost::arg<4>) const { return std::forward<A4>( a4_ ); }
1018 A5 && operator[] (boost::arg<5>) const { return std::forward<A5>( a5_ ); }
1019
1020 A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward<A1>( a1_ ); }
1021 A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward<A2>( a2_ ); }
1022 A3 && operator[] (boost::arg<3> (*) ()) const { return std::forward<A3>( a3_ ); }
1023 A4 && operator[] (boost::arg<4> (*) ()) const { return std::forward<A4>( a4_ ); }
1024 A5 && operator[] (boost::arg<5> (*) ()) const { return std::forward<A5>( a5_ ); }
1025
1026 template<class T> T & operator[] ( _bi::value<T> & v ) const { return v.get(); }
1027
1028 template<class T> T const & operator[] ( _bi::value<T> const & v ) const { return v.get(); }
1029
1030 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
1031
1032 template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const
1033 {
1034 rrlist5<A1&, A2&, A3&, A4&, A5&> a( a1_, a2_, a3_, a4_, a5_ );
1035 return b.eval( a );
1036 }
1037
1038 template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const
1039 {
1040 rrlist5<A1&, A2&, A3&, A4&, A5&> a( a1_, a2_, a3_, a4_, a5_ );
1041 return b.eval( a );
1042 }
1043};
1044
1045template< class A1, class A2, class A3, class A4, class A5, class A6 > class rrlist6
1046{
1047private:
1048
1049 A1 & a1_;
1050 A2 & a2_;
1051 A3 & a3_;
1052 A4 & a4_;
1053 A5 & a5_;
1054 A6 & a6_;
1055
1056public:
1057
1058 rrlist6( A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6 ): a1_( a1 ), a2_( a2 ), a3_( a3 ), a4_( a4 ), a5_( a5 ), a6_( a6 ) {}
1059
1060 A1 && operator[] (boost::arg<1>) const { return std::forward<A1>( a1_ ); }
1061 A2 && operator[] (boost::arg<2>) const { return std::forward<A2>( a2_ ); }
1062 A3 && operator[] (boost::arg<3>) const { return std::forward<A3>( a3_ ); }
1063 A4 && operator[] (boost::arg<4>) const { return std::forward<A4>( a4_ ); }
1064 A5 && operator[] (boost::arg<5>) const { return std::forward<A5>( a5_ ); }
1065 A6 && operator[] (boost::arg<6>) const { return std::forward<A6>( a6_ ); }
1066
1067 A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward<A1>( a1_ ); }
1068 A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward<A2>( a2_ ); }
1069 A3 && operator[] (boost::arg<3> (*) ()) const { return std::forward<A3>( a3_ ); }
1070 A4 && operator[] (boost::arg<4> (*) ()) const { return std::forward<A4>( a4_ ); }
1071 A5 && operator[] (boost::arg<5> (*) ()) const { return std::forward<A5>( a5_ ); }
1072 A6 && operator[] (boost::arg<6> (*) ()) const { return std::forward<A6>( a6_ ); }
1073
1074 template<class T> T & operator[] ( _bi::value<T> & v ) const { return v.get(); }
1075
1076 template<class T> T const & operator[] ( _bi::value<T> const & v ) const { return v.get(); }
1077
1078 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
1079
1080 template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const
1081 {
1082 rrlist6<A1&, A2&, A3&, A4&, A5&, A6&> a( a1_, a2_, a3_, a4_, a5_, a6_ );
1083 return b.eval( a );
1084 }
1085
1086 template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const
1087 {
1088 rrlist6<A1&, A2&, A3&, A4&, A5&, A6&> a( a1_, a2_, a3_, a4_, a5_, a6_ );
1089 return b.eval( a );
1090 }
1091};
1092
1093template< class A1, class A2, class A3, class A4, class A5, class A6, class A7 > class rrlist7
1094{
1095private:
1096
1097 A1 & a1_;
1098 A2 & a2_;
1099 A3 & a3_;
1100 A4 & a4_;
1101 A5 & a5_;
1102 A6 & a6_;
1103 A7 & a7_;
1104
1105public:
1106
1107 rrlist7( 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 ) {}
1108
1109 A1 && operator[] (boost::arg<1>) const { return std::forward<A1>( a1_ ); }
1110 A2 && operator[] (boost::arg<2>) const { return std::forward<A2>( a2_ ); }
1111 A3 && operator[] (boost::arg<3>) const { return std::forward<A3>( a3_ ); }
1112 A4 && operator[] (boost::arg<4>) const { return std::forward<A4>( a4_ ); }
1113 A5 && operator[] (boost::arg<5>) const { return std::forward<A5>( a5_ ); }
1114 A6 && operator[] (boost::arg<6>) const { return std::forward<A6>( a6_ ); }
1115 A7 && operator[] (boost::arg<7>) const { return std::forward<A7>( a7_ ); }
1116
1117 A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward<A1>( a1_ ); }
1118 A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward<A2>( a2_ ); }
1119 A3 && operator[] (boost::arg<3> (*) ()) const { return std::forward<A3>( a3_ ); }
1120 A4 && operator[] (boost::arg<4> (*) ()) const { return std::forward<A4>( a4_ ); }
1121 A5 && operator[] (boost::arg<5> (*) ()) const { return std::forward<A5>( a5_ ); }
1122 A6 && operator[] (boost::arg<6> (*) ()) const { return std::forward<A6>( a6_ ); }
1123 A7 && operator[] (boost::arg<7> (*) ()) const { return std::forward<A7>( a7_ ); }
1124
1125 template<class T> T & operator[] ( _bi::value<T> & v ) const { return v.get(); }
1126
1127 template<class T> T const & operator[] ( _bi::value<T> const & v ) const { return v.get(); }
1128
1129 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
1130
1131 template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const
1132 {
1133 rrlist7<A1&, A2&, A3&, A4&, A5&, A6&, A7&> a( a1_, a2_, a3_, a4_, a5_, a6_, a7_ );
1134 return b.eval( a );
1135 }
1136
1137 template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const
1138 {
1139 rrlist7<A1&, A2&, A3&, A4&, A5&, A6&, A7&> a( a1_, a2_, a3_, a4_, a5_, a6_, a7_ );
1140 return b.eval( a );
1141 }
1142};
1143
1144template< class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8 > class rrlist8
1145{
1146private:
1147
1148 A1 & a1_;
1149 A2 & a2_;
1150 A3 & a3_;
1151 A4 & a4_;
1152 A5 & a5_;
1153 A6 & a6_;
1154 A7 & a7_;
1155 A8 & a8_;
1156
1157public:
1158
1159 rrlist8( 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 ) {}
1160
1161 A1 && operator[] (boost::arg<1>) const { return std::forward<A1>( a1_ ); }
1162 A2 && operator[] (boost::arg<2>) const { return std::forward<A2>( a2_ ); }
1163 A3 && operator[] (boost::arg<3>) const { return std::forward<A3>( a3_ ); }
1164 A4 && operator[] (boost::arg<4>) const { return std::forward<A4>( a4_ ); }
1165 A5 && operator[] (boost::arg<5>) const { return std::forward<A5>( a5_ ); }
1166 A6 && operator[] (boost::arg<6>) const { return std::forward<A6>( a6_ ); }
1167 A7 && operator[] (boost::arg<7>) const { return std::forward<A7>( a7_ ); }
1168 A8 && operator[] (boost::arg<8>) const { return std::forward<A8>( a8_ ); }
1169
1170 A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward<A1>( a1_ ); }
1171 A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward<A2>( a2_ ); }
1172 A3 && operator[] (boost::arg<3> (*) ()) const { return std::forward<A3>( a3_ ); }
1173 A4 && operator[] (boost::arg<4> (*) ()) const { return std::forward<A4>( a4_ ); }
1174 A5 && operator[] (boost::arg<5> (*) ()) const { return std::forward<A5>( a5_ ); }
1175 A6 && operator[] (boost::arg<6> (*) ()) const { return std::forward<A6>( a6_ ); }
1176 A7 && operator[] (boost::arg<7> (*) ()) const { return std::forward<A7>( a7_ ); }
1177 A8 && operator[] (boost::arg<8> (*) ()) const { return std::forward<A8>( a8_ ); }
1178
1179 template<class T> T & operator[] ( _bi::value<T> & v ) const { return v.get(); }
1180
1181 template<class T> T const & operator[] ( _bi::value<T> const & v ) const { return v.get(); }
1182
1183 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
1184
1185 template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const
1186 {
1187 rrlist8<A1&, A2&, A3&, A4&, A5&, A6&, A7&, A8&> a( a1_, a2_, a3_, a4_, a5_, a6_, a7_, a8_ );
1188 return b.eval( a );
1189 }
1190
1191 template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const
1192 {
1193 rrlist8<A1&, A2&, A3&, A4&, A5&, A6&, A7&, A8&> a( a1_, a2_, a3_, a4_, a5_, a6_, a7_, a8_ );
1194 return b.eval( a );
1195 }
1196};
1197
1198template< class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9 > class rrlist9
1199{
1200private:
1201
1202 A1 & a1_;
1203 A2 & a2_;
1204 A3 & a3_;
1205 A4 & a4_;
1206 A5 & a5_;
1207 A6 & a6_;
1208 A7 & a7_;
1209 A8 & a8_;
1210 A9 & a9_;
1211
1212public:
1213
1214 rrlist9( 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 ) {}
1215
1216 A1 && operator[] (boost::arg<1>) const { return std::forward<A1>( a1_ ); }
1217 A2 && operator[] (boost::arg<2>) const { return std::forward<A2>( a2_ ); }
1218 A3 && operator[] (boost::arg<3>) const { return std::forward<A3>( a3_ ); }
1219 A4 && operator[] (boost::arg<4>) const { return std::forward<A4>( a4_ ); }
1220 A5 && operator[] (boost::arg<5>) const { return std::forward<A5>( a5_ ); }
1221 A6 && operator[] (boost::arg<6>) const { return std::forward<A6>( a6_ ); }
1222 A7 && operator[] (boost::arg<7>) const { return std::forward<A7>( a7_ ); }
1223 A8 && operator[] (boost::arg<8>) const { return std::forward<A8>( a8_ ); }
1224 A9 && operator[] (boost::arg<9>) const { return std::forward<A9>( a9_ ); }
1225
1226 A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward<A1>( a1_ ); }
1227 A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward<A2>( a2_ ); }
1228 A3 && operator[] (boost::arg<3> (*) ()) const { return std::forward<A3>( a3_ ); }
1229 A4 && operator[] (boost::arg<4> (*) ()) const { return std::forward<A4>( a4_ ); }
1230 A5 && operator[] (boost::arg<5> (*) ()) const { return std::forward<A5>( a5_ ); }
1231 A6 && operator[] (boost::arg<6> (*) ()) const { return std::forward<A6>( a6_ ); }
1232 A7 && operator[] (boost::arg<7> (*) ()) const { return std::forward<A7>( a7_ ); }
1233 A8 && operator[] (boost::arg<8> (*) ()) const { return std::forward<A8>( a8_ ); }
1234 A9 && operator[] (boost::arg<9> (*) ()) const { return std::forward<A9>( a9_ ); }
1235
1236 template<class T> T & operator[] ( _bi::value<T> & v ) const { return v.get(); }
1237
1238 template<class T> T const & operator[] ( _bi::value<T> const & v ) const { return v.get(); }
1239
1240 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
1241
1242 template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const
1243 {
1244 rrlist9<A1&, A2&, A3&, A4&, A5&, A6&, A7&, A8&, A9&> a( a1_, a2_, a3_, a4_, a5_, a6_, a7_, a8_, a9_ );
1245 return b.eval( a );
1246 }
1247
1248 template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const
1249 {
1250 rrlist9<A1&, A2&, A3&, A4&, A5&, A6&, A7&, A8&, A9&> a( a1_, a2_, a3_, a4_, a5_, a6_, a7_, a8_, a9_ );
1251 return b.eval( a );
1252 }
1253};
1254
1255template<class R, class F, class L> class bind_t
1256{
1257private:
1258
1259 F f_;
1260 L l_;
1261
1262public:
1263
1264 typedef typename result_traits<R, F>::type result_type;
1265 typedef bind_t this_type;
1266
1267 bind_t( F f, L const & l ): f_( f ), l_( l ) {}
1268
1269 //
1270
1271 result_type operator()()
1272 {
1273 list0 a;
1274 return l_( type<result_type>(), f_, a, 0 );
1275 }
1276
1277 result_type operator()() const
1278 {
1279 list0 a;
1280 return l_( type<result_type>(), f_, a, 0 );
1281 }
1282
1283 template<class A1> result_type operator()( A1 && a1 )
1284 {
1285 rrlist1< A1 > a( a1 );
1286 return l_( type<result_type>(), f_, a, 0 );
1287 }
1288
1289 template<class A1> result_type operator()( A1 && a1 ) const
1290 {
1291 rrlist1< A1 > a( a1 );
1292 return l_(type<result_type>(), f_, a, 0);
1293 }
1294
1295 template<class A1, class A2> result_type operator()( A1 && a1, A2 && a2 )
1296 {
1297 rrlist2< A1, A2 > a( a1, a2 );
1298 return l_( type<result_type>(), f_, a, 0 );
1299 }
1300
1301 template<class A1, class A2> result_type operator()( A1 && a1, A2 && a2 ) const
1302 {
1303 rrlist2< A1, A2 > a( a1, a2 );
1304 return l_( type<result_type>(), f_, a, 0 );
1305 }
1306
1307 template<class A1, class A2, class A3> result_type operator()( A1 && a1, A2 && a2, A3 && a3 )
1308 {
1309 rrlist3< A1, A2, A3 > a( a1, a2, a3 );
1310 return l_( type<result_type>(), f_, a, 0 );
1311 }
1312
1313 template<class A1, class A2, class A3> result_type operator()( A1 && a1, A2 && a2, A3 && a3 ) const
1314 {
1315 rrlist3< A1, A2, A3 > a( a1, a2, a3 );
1316 return l_( type<result_type>(), f_, a, 0 );
1317 }
1318
1319 template<class A1, class A2, class A3, class A4> result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4 )
1320 {
1321 rrlist4< A1, A2, A3, A4 > a( a1, a2, a3, a4 );
1322 return l_( type<result_type>(), f_, a, 0 );
1323 }
1324
1325 template<class A1, class A2, class A3, class A4> result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4 ) const
1326 {
1327 rrlist4< A1, A2, A3, A4 > a( a1, a2, a3, a4 );
1328 return l_( type<result_type>(), f_, a, 0 );
1329 }
1330
1331 template<class A1, class A2, class A3, class A4, class A5> result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5 )
1332 {
1333 rrlist5< A1, A2, A3, A4, A5 > a( a1, a2, a3, a4, a5 );
1334 return l_( type<result_type>(), f_, a, 0 );
1335 }
1336
1337 template<class A1, class A2, class A3, class A4, class A5> result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5 ) const
1338 {
1339 rrlist5< A1, A2, A3, A4, A5 > a( a1, a2, a3, a4, a5 );
1340 return l_( type<result_type>(), f_, a, 0 );
1341 }
1342
1343 template<class A1, class A2, class A3, class A4, class A5, class A6> result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6 )
1344 {
1345 rrlist6< A1, A2, A3, A4, A5, A6 > a( a1, a2, a3, a4, a5, a6 );
1346 return l_( type<result_type>(), f_, a, 0 );
1347 }
1348
1349 template<class A1, class A2, class A3, class A4, class A5, class A6> result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6 ) const
1350 {
1351 rrlist6< A1, A2, A3, A4, A5, A6 > a( a1, a2, a3, a4, a5, a6 );
1352 return l_( type<result_type>(), f_, a, 0 );
1353 }
1354
1355 template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7 )
1356 {
1357 rrlist7< A1, A2, A3, A4, A5, A6, A7 > a( a1, a2, a3, a4, a5, a6, a7 );
1358 return l_( type<result_type>(), f_, a, 0 );
1359 }
1360
1361 template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7 ) const
1362 {
1363 rrlist7< A1, A2, A3, A4, A5, A6, A7 > a( a1, a2, a3, a4, a5, a6, a7 );
1364 return l_( type<result_type>(), f_, a, 0 );
1365 }
1366
1367 template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7, A8 && a8 )
1368 {
1369 rrlist8< A1, A2, A3, A4, A5, A6, A7, A8 > a( a1, a2, a3, a4, a5, a6, a7, a8 );
1370 return l_( type<result_type>(), f_, a, 0 );
1371 }
1372
1373 template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7, A8 && a8 ) const
1374 {
1375 rrlist8< A1, A2, A3, A4, A5, A6, A7, A8 > a( a1, a2, a3, a4, a5, a6, a7, a8 );
1376 return l_( type<result_type>(), f_, a, 0 );
1377 }
1378
1379 template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7, A8 && a8, A9 && a9 )
1380 {
1381 rrlist9< A1, A2, A3, A4, A5, A6, A7, A8, A9 > a( a1, a2, a3, a4, a5, a6, a7, a8, a9 );
1382 return l_( type<result_type>(), f_, a, 0 );
1383 }
1384
1385 template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7, A8 && a8, A9 && a9 ) const
1386 {
1387 rrlist9< A1, A2, A3, A4, A5, A6, A7, A8, A9 > a( a1, a2, a3, a4, a5, a6, a7, a8, a9 );
1388 return l_( type<result_type>(), f_, a, 0 );
1389 }
1390
1391 //
1392
1393 template<class A> result_type eval( A & a )
1394 {
1395 return l_( type<result_type>(), f_, a, 0 );
1396 }
1397
1398 template<class A> result_type eval( A & a ) const
1399 {
1400 return l_( type<result_type>(), f_, a, 0 );
1401 }
1402
1403 template<class V> void accept( V & v ) const
1404 {
1405#if !defined( BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP ) && !defined( BOOST_BORLANDC )
1406 using boost::visit_each;
1407#endif
1408
1409 BOOST_BIND_VISIT_EACH( v, f_, 0 );
1410 l_.accept( v );
1411 }
1412
1413 bool compare( this_type const & rhs ) const
1414 {
1415 return ref_compare( f_, rhs.f_, 0 ) && l_ == rhs.l_;
1416 }
1417};
1418
1419#elif !defined( BOOST_NO_VOID_RETURNS )
1420
1421template<class R, class F, class L> class bind_t
1422{
1423public:
1424
1425 typedef bind_t this_type;
1426
1427 bind_t(F f, L const & l): f_(f), l_(l) {}
1428
1429#define BOOST_BIND_RETURN return
1430#include <boost/bind/bind_template.hpp>
1431#undef BOOST_BIND_RETURN
1432
1433};
1434
1435#else // no void returns
1436
1437template<class R> struct bind_t_generator
1438{
1439
1440template<class F, class L> class implementation
1441{
1442public:
1443
1444 typedef implementation this_type;
1445
1446 implementation(F f, L const & l): f_(f), l_(l) {}
1447
1448#define BOOST_BIND_RETURN return
1449#include <boost/bind/bind_template.hpp>
1450#undef BOOST_BIND_RETURN
1451
1452};
1453
1454};
1455
1456template<> struct bind_t_generator<void>
1457{
1458
1459template<class F, class L> class implementation
1460{
1461private:
1462
1463 typedef void R;
1464
1465public:
1466
1467 typedef implementation this_type;
1468
1469 implementation(F f, L const & l): f_(f), l_(l) {}
1470
1471#define BOOST_BIND_RETURN
1472#include <boost/bind/bind_template.hpp>
1473#undef BOOST_BIND_RETURN
1474
1475};
1476
1477};
1478
1479template<class R2, class F, class L> class bind_t: public bind_t_generator<R2>::BOOST_NESTED_TEMPLATE implementation<F, L>
1480{
1481public:
1482
1483 bind_t(F f, L const & l): bind_t_generator<R2>::BOOST_NESTED_TEMPLATE implementation<F, L>(f, l) {}
1484
1485};
1486
1487#endif
1488
1489// function_equal
1490
1491#ifndef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
1492
1493// put overloads in _bi, rely on ADL
1494
1495# ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
1496
1497template<class R, class F, class L> bool function_equal( bind_t<R, F, L> const & a, bind_t<R, F, L> const & b )
1498{
1499 return a.compare(b);
1500}
1501
1502# else
1503
1504template<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 )
1505{
1506 return a.compare(b);
1507}
1508
1509# endif // #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
1510
1511#else // BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
1512
1513// put overloads in boost
1514
1515} // namespace _bi
1516
1517# ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
1518
1519template<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 )
1520{
1521 return a.compare(b);
1522}
1523
1524# else
1525
1526template<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 )
1527{
1528 return a.compare(b);
1529}
1530
1531# endif // #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
1532
1533namespace _bi
1534{
1535
1536#endif // BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
1537
1538// add_value
1539
1540#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) || (__SUNPRO_CC >= 0x530)
1541
1542#if defined( BOOST_BORLANDC ) && BOOST_WORKAROUND( BOOST_BORLANDC, BOOST_TESTED_AT(0x582) )
1543
1544template<class T> struct add_value
1545{
1546 typedef _bi::value<T> type;
1547};
1548
1549#else
1550
1551template< class T, int I > struct add_value_2
1552{
1553 typedef boost::arg<I> type;
1554};
1555
1556template< class T > struct add_value_2< T, 0 >
1557{
1558 typedef _bi::value< T > type;
1559};
1560
1561template<class T> struct add_value
1562{
1563 typedef typename add_value_2< T, boost::is_placeholder< T >::value >::type type;
1564};
1565
1566#endif
1567
1568template<class T> struct add_value< value<T> >
1569{
1570 typedef _bi::value<T> type;
1571};
1572
1573template<class T> struct add_value< reference_wrapper<T> >
1574{
1575 typedef reference_wrapper<T> type;
1576};
1577
1578template<int I> struct add_value< arg<I> >
1579{
1580 typedef boost::arg<I> type;
1581};
1582
1583template<int I> struct add_value< arg<I> (*) () >
1584{
1585 typedef boost::arg<I> (*type) ();
1586};
1587
1588template<class R, class F, class L> struct add_value< bind_t<R, F, L> >
1589{
1590 typedef bind_t<R, F, L> type;
1591};
1592
1593#else
1594
1595template<int I> struct _avt_0;
1596
1597template<> struct _avt_0<1>
1598{
1599 template<class T> struct inner
1600 {
1601 typedef T type;
1602 };
1603};
1604
1605template<> struct _avt_0<2>
1606{
1607 template<class T> struct inner
1608 {
1609 typedef value<T> type;
1610 };
1611};
1612
1613typedef char (&_avt_r1) [1];
1614typedef char (&_avt_r2) [2];
1615
1616template<class T> _avt_r1 _avt_f(value<T>);
1617template<class T> _avt_r1 _avt_f(reference_wrapper<T>);
1618template<int I> _avt_r1 _avt_f(arg<I>);
1619template<int I> _avt_r1 _avt_f(arg<I> (*) ());
1620template<class R, class F, class L> _avt_r1 _avt_f(bind_t<R, F, L>);
1621
1622_avt_r2 _avt_f(...);
1623
1624template<class T> struct add_value
1625{
1626 static T t();
1627 typedef typename _avt_0<sizeof(_avt_f(t()))>::template inner<T>::type type;
1628};
1629
1630#endif
1631
1632// list_av_N
1633
1634template<class A1> struct list_av_1
1635{
1636 typedef typename add_value<A1>::type B1;
1637 typedef list1<B1> type;
1638};
1639
1640template<class A1, class A2> struct list_av_2
1641{
1642 typedef typename add_value<A1>::type B1;
1643 typedef typename add_value<A2>::type B2;
1644 typedef list2<B1, B2> type;
1645};
1646
1647template<class A1, class A2, class A3> struct list_av_3
1648{
1649 typedef typename add_value<A1>::type B1;
1650 typedef typename add_value<A2>::type B2;
1651 typedef typename add_value<A3>::type B3;
1652 typedef list3<B1, B2, B3> type;
1653};
1654
1655template<class A1, class A2, class A3, class A4> struct list_av_4
1656{
1657 typedef typename add_value<A1>::type B1;
1658 typedef typename add_value<A2>::type B2;
1659 typedef typename add_value<A3>::type B3;
1660 typedef typename add_value<A4>::type B4;
1661 typedef list4<B1, B2, B3, B4> type;
1662};
1663
1664template<class A1, class A2, class A3, class A4, class A5> struct list_av_5
1665{
1666 typedef typename add_value<A1>::type B1;
1667 typedef typename add_value<A2>::type B2;
1668 typedef typename add_value<A3>::type B3;
1669 typedef typename add_value<A4>::type B4;
1670 typedef typename add_value<A5>::type B5;
1671 typedef list5<B1, B2, B3, B4, B5> type;
1672};
1673
1674template<class A1, class A2, class A3, class A4, class A5, class A6> struct list_av_6
1675{
1676 typedef typename add_value<A1>::type B1;
1677 typedef typename add_value<A2>::type B2;
1678 typedef typename add_value<A3>::type B3;
1679 typedef typename add_value<A4>::type B4;
1680 typedef typename add_value<A5>::type B5;
1681 typedef typename add_value<A6>::type B6;
1682 typedef list6<B1, B2, B3, B4, B5, B6> type;
1683};
1684
1685template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> struct list_av_7
1686{
1687 typedef typename add_value<A1>::type B1;
1688 typedef typename add_value<A2>::type B2;
1689 typedef typename add_value<A3>::type B3;
1690 typedef typename add_value<A4>::type B4;
1691 typedef typename add_value<A5>::type B5;
1692 typedef typename add_value<A6>::type B6;
1693 typedef typename add_value<A7>::type B7;
1694 typedef list7<B1, B2, B3, B4, B5, B6, B7> type;
1695};
1696
1697template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> struct list_av_8
1698{
1699 typedef typename add_value<A1>::type B1;
1700 typedef typename add_value<A2>::type B2;
1701 typedef typename add_value<A3>::type B3;
1702 typedef typename add_value<A4>::type B4;
1703 typedef typename add_value<A5>::type B5;
1704 typedef typename add_value<A6>::type B6;
1705 typedef typename add_value<A7>::type B7;
1706 typedef typename add_value<A8>::type B8;
1707 typedef list8<B1, B2, B3, B4, B5, B6, B7, B8> type;
1708};
1709
1710template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> struct list_av_9
1711{
1712 typedef typename add_value<A1>::type B1;
1713 typedef typename add_value<A2>::type B2;
1714 typedef typename add_value<A3>::type B3;
1715 typedef typename add_value<A4>::type B4;
1716 typedef typename add_value<A5>::type B5;
1717 typedef typename add_value<A6>::type B6;
1718 typedef typename add_value<A7>::type B7;
1719 typedef typename add_value<A8>::type B8;
1720 typedef typename add_value<A9>::type B9;
1721 typedef list9<B1, B2, B3, B4, B5, B6, B7, B8, B9> type;
1722};
1723
1724// operator!
1725
1726struct logical_not
1727{
1728 template<class V> bool operator()(V const & v) const { return !v; }
1729};
1730
1731template<class R, class F, class L>
1732 bind_t< bool, logical_not, list1< bind_t<R, F, L> > >
1733 operator! (bind_t<R, F, L> const & f)
1734{
1735 typedef list1< bind_t<R, F, L> > list_type;
1736 return bind_t<bool, logical_not, list_type> ( logical_not(), list_type(f) );
1737}
1738
1739// relational operators
1740
1741#define BOOST_BIND_OPERATOR( op, name ) \
1742\
1743struct name \
1744{ \
1745 template<class V, class W> bool operator()(V const & v, W const & w) const { return v op w; } \
1746}; \
1747 \
1748template<class R, class F, class L, class A2> \
1749 bind_t< bool, name, list2< bind_t<R, F, L>, typename add_value<A2>::type > > \
1750 operator op (bind_t<R, F, L> const & f, A2 a2) \
1751{ \
1752 typedef typename add_value<A2>::type B2; \
1753 typedef list2< bind_t<R, F, L>, B2> list_type; \
1754 return bind_t<bool, name, list_type> ( name(), list_type(f, a2) ); \
1755}
1756
1757BOOST_BIND_OPERATOR( ==, equal )
1758BOOST_BIND_OPERATOR( !=, not_equal )
1759
1760BOOST_BIND_OPERATOR( <, less )
1761BOOST_BIND_OPERATOR( <=, less_equal )
1762
1763BOOST_BIND_OPERATOR( >, greater )
1764BOOST_BIND_OPERATOR( >=, greater_equal )
1765
1766BOOST_BIND_OPERATOR( &&, logical_and )
1767BOOST_BIND_OPERATOR( ||, logical_or )
1768
1769#undef BOOST_BIND_OPERATOR
1770
1771#if defined(__GNUC__) && BOOST_WORKAROUND(__GNUC__, < 3)
1772
1773// resolve ambiguity with rel_ops
1774
1775#define BOOST_BIND_OPERATOR( op, name ) \
1776\
1777template<class R, class F, class L> \
1778 bind_t< bool, name, list2< bind_t<R, F, L>, bind_t<R, F, L> > > \
1779 operator op (bind_t<R, F, L> const & f, bind_t<R, F, L> const & g) \
1780{ \
1781 typedef list2< bind_t<R, F, L>, bind_t<R, F, L> > list_type; \
1782 return bind_t<bool, name, list_type> ( name(), list_type(f, g) ); \
1783}
1784
1785BOOST_BIND_OPERATOR( !=, not_equal )
1786BOOST_BIND_OPERATOR( <=, less_equal )
1787BOOST_BIND_OPERATOR( >, greater )
1788BOOST_BIND_OPERATOR( >=, greater_equal )
1789
1790#endif
1791
1792// visit_each, ADL
1793
1794#if !defined( BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP ) && !defined( BOOST_BORLANDC ) \
1795 && !(defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ <= 3)
1796
1797template<class V, class T> void visit_each( V & v, value<T> const & t, int )
1798{
1799 using boost::visit_each;
1800 BOOST_BIND_VISIT_EACH( v, t.get(), 0 );
1801}
1802
1803template<class V, class R, class F, class L> void visit_each( V & v, bind_t<R, F, L> const & t, int )
1804{
1805 t.accept( v );
1806}
1807
1808#endif
1809
1810} // namespace _bi
1811
1812// visit_each, no ADL
1813
1814#if defined( BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP ) || defined( BOOST_BORLANDC ) \
1815 || (defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ <= 3)
1816
1817template<class V, class T> void visit_each( V & v, _bi::value<T> const & t, int )
1818{
1819 BOOST_BIND_VISIT_EACH( v, t.get(), 0 );
1820}
1821
1822template<class V, class R, class F, class L> void visit_each( V & v, _bi::bind_t<R, F, L> const & t, int )
1823{
1824 t.accept( v );
1825}
1826
1827#endif
1828
1829// is_bind_expression
1830
1831template< class T > struct is_bind_expression
1832{
1833 enum _vt { value = 0 };
1834};
1835
1836#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
1837
1838template< class R, class F, class L > struct is_bind_expression< _bi::bind_t< R, F, L > >
1839{
1840 enum _vt { value = 1 };
1841};
1842
1843#endif
1844
1845// bind
1846
1847#ifndef BOOST_BIND
1848#define BOOST_BIND bind
1849#endif
1850
1851// generic function objects
1852
1853template<class R, class F>
1854 _bi::bind_t<R, F, _bi::list0>
1855 BOOST_BIND(F f)
1856{
1857 typedef _bi::list0 list_type;
1858 return _bi::bind_t<R, F, list_type> (f, list_type());
1859}
1860
1861template<class R, class F, class A1>
1862 _bi::bind_t<R, F, typename _bi::list_av_1<A1>::type>
1863 BOOST_BIND(F f, A1 a1)
1864{
1865 typedef typename _bi::list_av_1<A1>::type list_type;
1866 return _bi::bind_t<R, F, list_type> (f, list_type(a1));
1867}
1868
1869template<class R, class F, class A1, class A2>
1870 _bi::bind_t<R, F, typename _bi::list_av_2<A1, A2>::type>
1871 BOOST_BIND(F f, A1 a1, A2 a2)
1872{
1873 typedef typename _bi::list_av_2<A1, A2>::type list_type;
1874 return _bi::bind_t<R, F, list_type> (f, list_type(a1, a2));
1875}
1876
1877template<class R, class F, class A1, class A2, class A3>
1878 _bi::bind_t<R, F, typename _bi::list_av_3<A1, A2, A3>::type>
1879 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3)
1880{
1881 typedef typename _bi::list_av_3<A1, A2, A3>::type list_type;
1882 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3));
1883}
1884
1885template<class R, class F, class A1, class A2, class A3, class A4>
1886 _bi::bind_t<R, F, typename _bi::list_av_4<A1, A2, A3, A4>::type>
1887 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4)
1888{
1889 typedef typename _bi::list_av_4<A1, A2, A3, A4>::type list_type;
1890 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4));
1891}
1892
1893template<class R, class F, class A1, class A2, class A3, class A4, class A5>
1894 _bi::bind_t<R, F, typename _bi::list_av_5<A1, A2, A3, A4, A5>::type>
1895 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5)
1896{
1897 typedef typename _bi::list_av_5<A1, A2, A3, A4, A5>::type list_type;
1898 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5));
1899}
1900
1901template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6>
1902 _bi::bind_t<R, F, typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type>
1903 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6)
1904{
1905 typedef typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type list_type;
1906 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6));
1907}
1908
1909template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7>
1910 _bi::bind_t<R, F, typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type>
1911 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7)
1912{
1913 typedef typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type list_type;
1914 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7));
1915}
1916
1917template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
1918 _bi::bind_t<R, F, typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type>
1919 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8)
1920{
1921 typedef typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type list_type;
1922 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8));
1923}
1924
1925template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9>
1926 _bi::bind_t<R, F, typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type>
1927 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9)
1928{
1929 typedef typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type list_type;
1930 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9));
1931}
1932
1933// generic function objects, alternative syntax
1934
1935template<class R, class F>
1936 _bi::bind_t<R, F, _bi::list0>
1937 BOOST_BIND(boost::type<R>, F f)
1938{
1939 typedef _bi::list0 list_type;
1940 return _bi::bind_t<R, F, list_type> (f, list_type());
1941}
1942
1943template<class R, class F, class A1>
1944 _bi::bind_t<R, F, typename _bi::list_av_1<A1>::type>
1945 BOOST_BIND(boost::type<R>, F f, A1 a1)
1946{
1947 typedef typename _bi::list_av_1<A1>::type list_type;
1948 return _bi::bind_t<R, F, list_type> (f, list_type(a1));
1949}
1950
1951template<class R, class F, class A1, class A2>
1952 _bi::bind_t<R, F, typename _bi::list_av_2<A1, A2>::type>
1953 BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2)
1954{
1955 typedef typename _bi::list_av_2<A1, A2>::type list_type;
1956 return _bi::bind_t<R, F, list_type> (f, list_type(a1, a2));
1957}
1958
1959template<class R, class F, class A1, class A2, class A3>
1960 _bi::bind_t<R, F, typename _bi::list_av_3<A1, A2, A3>::type>
1961 BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3)
1962{
1963 typedef typename _bi::list_av_3<A1, A2, A3>::type list_type;
1964 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3));
1965}
1966
1967template<class R, class F, class A1, class A2, class A3, class A4>
1968 _bi::bind_t<R, F, typename _bi::list_av_4<A1, A2, A3, A4>::type>
1969 BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3, A4 a4)
1970{
1971 typedef typename _bi::list_av_4<A1, A2, A3, A4>::type list_type;
1972 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4));
1973}
1974
1975template<class R, class F, class A1, class A2, class A3, class A4, class A5>
1976 _bi::bind_t<R, F, typename _bi::list_av_5<A1, A2, A3, A4, A5>::type>
1977 BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5)
1978{
1979 typedef typename _bi::list_av_5<A1, A2, A3, A4, A5>::type list_type;
1980 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5));
1981}
1982
1983template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6>
1984 _bi::bind_t<R, F, typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type>
1985 BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6)
1986{
1987 typedef typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type list_type;
1988 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6));
1989}
1990
1991template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7>
1992 _bi::bind_t<R, F, typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type>
1993 BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7)
1994{
1995 typedef typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type list_type;
1996 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7));
1997}
1998
1999template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
2000 _bi::bind_t<R, F, typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type>
2001 BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8)
2002{
2003 typedef typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type list_type;
2004 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8));
2005}
2006
2007template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9>
2008 _bi::bind_t<R, F, typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type>
2009 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)
2010{
2011 typedef typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type list_type;
2012 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9));
2013}
2014
2015#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
2016
2017// adaptable function objects
2018
2019template<class F>
2020 _bi::bind_t<_bi::unspecified, F, _bi::list0>
2021 BOOST_BIND(F f)
2022{
2023 typedef _bi::list0 list_type;
2024 return _bi::bind_t<_bi::unspecified, F, list_type> (f, list_type());
2025}
2026
2027template<class F, class A1>
2028 _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_1<A1>::type>
2029 BOOST_BIND(F f, A1 a1)
2030{
2031 typedef typename _bi::list_av_1<A1>::type list_type;
2032 return _bi::bind_t<_bi::unspecified, F, list_type> (f, list_type(a1));
2033}
2034
2035template<class F, class A1, class A2>
2036 _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_2<A1, A2>::type>
2037 BOOST_BIND(F f, A1 a1, A2 a2)
2038{
2039 typedef typename _bi::list_av_2<A1, A2>::type list_type;
2040 return _bi::bind_t<_bi::unspecified, F, list_type> (f, list_type(a1, a2));
2041}
2042
2043template<class F, class A1, class A2, class A3>
2044 _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_3<A1, A2, A3>::type>
2045 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3)
2046{
2047 typedef typename _bi::list_av_3<A1, A2, A3>::type list_type;
2048 return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3));
2049}
2050
2051template<class F, class A1, class A2, class A3, class A4>
2052 _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_4<A1, A2, A3, A4>::type>
2053 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4)
2054{
2055 typedef typename _bi::list_av_4<A1, A2, A3, A4>::type list_type;
2056 return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4));
2057}
2058
2059template<class F, class A1, class A2, class A3, class A4, class A5>
2060 _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_5<A1, A2, A3, A4, A5>::type>
2061 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5)
2062{
2063 typedef typename _bi::list_av_5<A1, A2, A3, A4, A5>::type list_type;
2064 return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5));
2065}
2066
2067template<class F, class A1, class A2, class A3, class A4, class A5, class A6>
2068 _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type>
2069 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6)
2070{
2071 typedef typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type list_type;
2072 return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6));
2073}
2074
2075template<class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7>
2076 _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type>
2077 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7)
2078{
2079 typedef typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type list_type;
2080 return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7));
2081}
2082
2083template<class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
2084 _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type>
2085 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8)
2086{
2087 typedef typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type list_type;
2088 return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8));
2089}
2090
2091template<class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9>
2092 _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type>
2093 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9)
2094{
2095 typedef typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type list_type;
2096 return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9));
2097}
2098
2099#endif // !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
2100
2101// function pointers
2102
2103#define BOOST_BIND_CC
2104#define BOOST_BIND_ST
2105#define BOOST_BIND_NOEXCEPT
2106
2107#include <boost/bind/bind_cc.hpp>
2108
2109# if defined( __cpp_noexcept_function_type ) || defined( _NOEXCEPT_TYPES_SUPPORTED )
2110# undef BOOST_BIND_NOEXCEPT
2111# define BOOST_BIND_NOEXCEPT noexcept
2112# include <boost/bind/bind_cc.hpp>
2113# endif
2114
2115#undef BOOST_BIND_CC
2116#undef BOOST_BIND_ST
2117#undef BOOST_BIND_NOEXCEPT
2118
2119#if defined(BOOST_BIND_ENABLE_STDCALL) && !defined(_M_X64)
2120
2121#define BOOST_BIND_CC __stdcall
2122#define BOOST_BIND_ST
2123#define BOOST_BIND_NOEXCEPT
2124
2125#include <boost/bind/bind_cc.hpp>
2126
2127#undef BOOST_BIND_CC
2128#undef BOOST_BIND_ST
2129#undef BOOST_BIND_NOEXCEPT
2130
2131#endif
2132
2133#if defined(BOOST_BIND_ENABLE_FASTCALL) && !defined(_M_X64)
2134
2135#define BOOST_BIND_CC __fastcall
2136#define BOOST_BIND_ST
2137#define BOOST_BIND_NOEXCEPT
2138
2139#include <boost/bind/bind_cc.hpp>
2140
2141#undef BOOST_BIND_CC
2142#undef BOOST_BIND_ST
2143#undef BOOST_BIND_NOEXCEPT
2144
2145#endif
2146
2147#ifdef BOOST_BIND_ENABLE_PASCAL
2148
2149#define BOOST_BIND_ST pascal
2150#define BOOST_BIND_CC
2151#define BOOST_BIND_NOEXCEPT
2152
2153#include <boost/bind/bind_cc.hpp>
2154
2155#undef BOOST_BIND_ST
2156#undef BOOST_BIND_CC
2157#undef BOOST_BIND_NOEXCEPT
2158
2159#endif
2160
2161// member function pointers
2162
2163#define BOOST_BIND_MF_NAME(X) X
2164#define BOOST_BIND_MF_CC
2165#define BOOST_BIND_MF_NOEXCEPT
2166
2167#include <boost/bind/bind_mf_cc.hpp>
2168#include <boost/bind/bind_mf2_cc.hpp>
2169
2170# if defined( __cpp_noexcept_function_type ) || defined( _NOEXCEPT_TYPES_SUPPORTED )
2171# undef BOOST_BIND_MF_NOEXCEPT
2172# define BOOST_BIND_MF_NOEXCEPT noexcept
2173# include <boost/bind/bind_mf_cc.hpp>
2174# include <boost/bind/bind_mf2_cc.hpp>
2175# endif
2176
2177#undef BOOST_BIND_MF_NAME
2178#undef BOOST_BIND_MF_CC
2179#undef BOOST_BIND_MF_NOEXCEPT
2180
2181#if defined(BOOST_MEM_FN_ENABLE_CDECL) && !defined(_M_X64)
2182
2183#define BOOST_BIND_MF_NAME(X) X##_cdecl
2184#define BOOST_BIND_MF_CC __cdecl
2185#define BOOST_BIND_MF_NOEXCEPT
2186
2187#include <boost/bind/bind_mf_cc.hpp>
2188#include <boost/bind/bind_mf2_cc.hpp>
2189
2190#undef BOOST_BIND_MF_NAME
2191#undef BOOST_BIND_MF_CC
2192#undef BOOST_BIND_MF_NOEXCEPT
2193
2194#endif
2195
2196#if defined(BOOST_MEM_FN_ENABLE_STDCALL) && !defined(_M_X64)
2197
2198#define BOOST_BIND_MF_NAME(X) X##_stdcall
2199#define BOOST_BIND_MF_CC __stdcall
2200#define BOOST_BIND_MF_NOEXCEPT
2201
2202#include <boost/bind/bind_mf_cc.hpp>
2203#include <boost/bind/bind_mf2_cc.hpp>
2204
2205#undef BOOST_BIND_MF_NAME
2206#undef BOOST_BIND_MF_CC
2207#undef BOOST_BIND_MF_NOEXCEPT
2208
2209#endif
2210
2211#if defined(BOOST_MEM_FN_ENABLE_FASTCALL) && !defined(_M_X64)
2212
2213#define BOOST_BIND_MF_NAME(X) X##_fastcall
2214#define BOOST_BIND_MF_CC __fastcall
2215#define BOOST_BIND_MF_NOEXCEPT
2216
2217#include <boost/bind/bind_mf_cc.hpp>
2218#include <boost/bind/bind_mf2_cc.hpp>
2219
2220#undef BOOST_BIND_MF_NAME
2221#undef BOOST_BIND_MF_CC
2222#undef BOOST_BIND_MF_NOEXCEPT
2223
2224#endif
2225
2226// data member pointers
2227
2228#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) || defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \
2229 || ( defined(BOOST_BORLANDC) && BOOST_WORKAROUND( BOOST_BORLANDC, BOOST_TESTED_AT( 0x620 ) ) )
2230
2231template<class R, class T, class A1>
2232_bi::bind_t< R, _mfi::dm<R, T>, typename _bi::list_av_1<A1>::type >
2233 BOOST_BIND(R T::*f, A1 a1)
2234{
2235 typedef _mfi::dm<R, T> F;
2236 typedef typename _bi::list_av_1<A1>::type list_type;
2237 return _bi::bind_t<R, F, list_type>( F(f), list_type(a1) );
2238}
2239
2240#else
2241
2242namespace _bi
2243{
2244
2245template< class Pm, int I > struct add_cref;
2246
2247template< class M, class T > struct add_cref< M T::*, 0 >
2248{
2249 typedef M type;
2250};
2251
2252template< class M, class T > struct add_cref< M T::*, 1 >
2253{
2254#ifdef BOOST_MSVC
2255#pragma warning(push)
2256#pragma warning(disable:4180)
2257#endif
2258 typedef M const & type;
2259#ifdef BOOST_MSVC
2260#pragma warning(pop)
2261#endif
2262};
2263
2264template< class R, class T > struct add_cref< R (T::*) (), 1 >
2265{
2266 typedef void type;
2267};
2268
2269#if !defined(__IBMCPP__) || __IBMCPP_FUNC_CV_TMPL_ARG_DEDUCTION
2270
2271template< class R, class T > struct add_cref< R (T::*) () const, 1 >
2272{
2273 typedef void type;
2274};
2275
2276#if defined( __cpp_noexcept_function_type ) || defined( _NOEXCEPT_TYPES_SUPPORTED )
2277
2278template< class R, class T > struct add_cref< R (T::*) () const noexcept, 1 >
2279{
2280 typedef void type;
2281};
2282
2283#endif // __cpp_noexcept_function_type
2284
2285#endif // __IBMCPP__
2286
2287template<class R> struct isref
2288{
2289 enum value_type { value = 0 };
2290};
2291
2292template<class R> struct isref< R& >
2293{
2294 enum value_type { value = 1 };
2295};
2296
2297template<class R> struct isref< R* >
2298{
2299 enum value_type { value = 1 };
2300};
2301
2302template<class Pm, class A1> struct dm_result
2303{
2304 typedef typename add_cref< Pm, 1 >::type type;
2305};
2306
2307template<class Pm, class R, class F, class L> struct dm_result< Pm, bind_t<R, F, L> >
2308{
2309 typedef typename bind_t<R, F, L>::result_type result_type;
2310 typedef typename add_cref< Pm, isref< result_type >::value >::type type;
2311};
2312
2313} // namespace _bi
2314
2315template< class A1, class M, class T >
2316
2317_bi::bind_t<
2318 typename _bi::dm_result< M T::*, A1 >::type,
2319 _mfi::dm<M, T>,
2320 typename _bi::list_av_1<A1>::type
2321>
2322
2323BOOST_BIND( M T::*f, A1 a1 )
2324{
2325 typedef typename _bi::dm_result< M T::*, A1 >::type result_type;
2326 typedef _mfi::dm<M, T> F;
2327 typedef typename _bi::list_av_1<A1>::type list_type;
2328 return _bi::bind_t< result_type, F, list_type >( F( f ), list_type( a1 ) );
2329}
2330
2331#endif
2332
2333} // namespace boost
2334
2335#ifndef BOOST_BIND_NO_PLACEHOLDERS
2336
2337# include <boost/bind/placeholders.hpp>
2338
2339#endif
2340
2341#ifdef BOOST_MSVC
2342# pragma warning(default: 4512) // assignment operator could not be generated
2343# pragma warning(pop)
2344#endif
2345
2346#endif // #ifndef BOOST_BIND_BIND_HPP_INCLUDED
2347

source code of include/boost/bind/bind.hpp

Morty Proxy This is a proxified and sanitized view of the page, visit original site.