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