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