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