Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/boost/bind.hpp @ 66

Last change on this file since 66 was 29, checked in by landauf, 16 years ago

updated boost from 1_33_1 to 1_34_1

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