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

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