1 #ifndef BOOST_BIND_BIND_HPP_INCLUDED
2 #define BOOST_BIND_BIND_HPP_INCLUDED
3 
4 // MS compatible compilers support #pragma once
5 
6 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
7 # pragma once
8 #endif
9 
10 //
11 //  bind.hpp - binds function objects to arguments
12 //
13 //  Copyright (c) 2001-2004 Peter Dimov and Multi Media Ltd.
14 //  Copyright (c) 2001 David Abrahams
15 //  Copyright (c) 2005 Peter Dimov
16 //
17 // Distributed under the Boost Software License, Version 1.0. (See
18 // accompanying file LICENSE_1_0.txt or copy at
19 // http://www.boost.org/LICENSE_1_0.txt)
20 //
21 //  See http://www.boost.org/libs/bind/bind.html for documentation.
22 //
23 
24 #include <boost/config.hpp>
25 #include <boost/ref.hpp>
26 #include <boost/mem_fn.hpp>
27 #include <boost/type.hpp>
28 #include <boost/is_placeholder.hpp>
29 #include <boost/bind/arg.hpp>
30 #include <boost/detail/workaround.hpp>
31 #include <boost/visit_each.hpp>
32 #include <boost/core/enable_if.hpp>
33 #include <boost/core/is_same.hpp>
34 
35 // Borland-specific bug, visit_each() silently fails to produce code
36 
37 #if defined(__BORLANDC__)
38 #  define BOOST_BIND_VISIT_EACH boost::visit_each
39 #else
40 #  define BOOST_BIND_VISIT_EACH visit_each
41 #endif
42 
43 #include <boost/bind/storage.hpp>
44 
45 #ifdef BOOST_MSVC
46 # pragma warning(push)
47 # pragma warning(disable: 4512) // assignment operator could not be generated
48 #endif
49 
50 namespace boost
51 {
52 
53 template<class T> class weak_ptr;
54 
55 namespace _bi // implementation details
56 {
57 
58 // result_traits
59 
60 template<class R, class F> struct result_traits
61 {
62     typedef R type;
63 };
64 
65 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
66 
67 struct unspecified {};
68 
69 template<class F> struct result_traits<unspecified, F>
70 {
71     typedef typename F::result_type type;
72 };
73 
74 template<class F> struct result_traits< unspecified, reference_wrapper<F> >
75 {
76     typedef typename F::result_type type;
77 };
78 
79 #endif
80 
81 // ref_compare
82 
ref_compare(T const & a,T const & b,long)83 template<class T> bool ref_compare( T const & a, T const & b, long )
84 {
85     return a == b;
86 }
87 
ref_compare(arg<I> const &,arg<I> const &,int)88 template<int I> bool ref_compare( arg<I> const &, arg<I> const &, int )
89 {
90     return true;
91 }
92 
ref_compare(arg<I> (*)(),arg<I> (*)(),int)93 template<int I> bool ref_compare( arg<I> (*) (), arg<I> (*) (), int )
94 {
95     return true;
96 }
97 
ref_compare(reference_wrapper<T> const & a,reference_wrapper<T> const & b,int)98 template<class T> bool ref_compare( reference_wrapper<T> const & a, reference_wrapper<T> const & b, int )
99 {
100     return a.get_pointer() == b.get_pointer();
101 }
102 
103 // bind_t forward declaration for listN
104 
105 template<class R, class F, class L> class bind_t;
106 
ref_compare(bind_t<R,F,L> const & a,bind_t<R,F,L> const & b,int)107 template<class R, class F, class L> bool ref_compare( bind_t<R, F, L> const & a, bind_t<R, F, L> const & b, int )
108 {
109     return a.compare( b );
110 }
111 
112 // value
113 
114 template<class T> class value
115 {
116 public:
117 
value(T const & t)118     value(T const & t): t_(t) {}
119 
get()120     T & get() { return t_; }
get() const121     T const & get() const { return t_; }
122 
operator ==(value const & rhs) const123     bool operator==(value const & rhs) const
124     {
125         return t_ == rhs.t_;
126     }
127 
128 private:
129 
130     T t_;
131 };
132 
133 // ref_compare for weak_ptr
134 
ref_compare(value<weak_ptr<T>> const & a,value<weak_ptr<T>> const & b,int)135 template<class T> bool ref_compare( value< weak_ptr<T> > const & a, value< weak_ptr<T> > const & b, int )
136 {
137     return !(a.get() < b.get()) && !(b.get() < a.get());
138 }
139 
140 // type
141 
142 template<class T> class type {};
143 
144 // unwrap
145 
146 template<class F> struct unwrapper
147 {
unwrapboost::_bi::unwrapper148     static inline F & unwrap( F & f, long )
149     {
150         return f;
151     }
152 
unwrapboost::_bi::unwrapper153     template<class F2> static inline F2 & unwrap( reference_wrapper<F2> rf, int )
154     {
155         return rf.get();
156     }
157 
unwrapboost::_bi::unwrapper158     template<class R, class T> static inline _mfi::dm<R, T> unwrap( R T::* pm, int )
159     {
160         return _mfi::dm<R, T>( pm );
161     }
162 };
163 
164 // listN
165 
166 class list0
167 {
168 public:
169 
list0()170     list0() {}
171 
operator [](_bi::value<T> & v) const172     template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
173 
operator [](_bi::value<T> const & v) const174     template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
175 
operator [](reference_wrapper<T> const & v) const176     template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
177 
operator [](bind_t<R,F,L> & b) const178     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); }
179 
operator [](bind_t<R,F,L> const & b) const180     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); }
181 
182     template<class R, class F, class A> R operator()(type<R>, F & f, A &, long)
183     {
184         return unwrapper<F>::unwrap(f, 0)();
185     }
186 
187     template<class R, class F, class A> R operator()(type<R>, F const & f, A &, long) const
188     {
189         return unwrapper<F const>::unwrap(f, 0)();
190     }
191 
operator ()(type<void>,F & f,A &,int)192     template<class F, class A> void operator()(type<void>, F & f, A &, int)
193     {
194         unwrapper<F>::unwrap(f, 0)();
195     }
196 
operator ()(type<void>,F const & f,A &,int) const197     template<class F, class A> void operator()(type<void>, F const & f, A &, int) const
198     {
199         unwrapper<F const>::unwrap(f, 0)();
200     }
201 
accept(V &) const202     template<class V> void accept(V &) const
203     {
204     }
205 
operator ==(list0 const &) const206     bool operator==(list0 const &) const
207     {
208         return true;
209     }
210 };
211 
212 #ifdef BOOST_MSVC
213 // MSVC is bright enough to realise that the parameter rhs
214 // in operator==may be unused for some template argument types:
215 #pragma warning(push)
216 #pragma warning(disable:4100)
217 #endif
218 
219 template< class A1 > class list1: private storage1< A1 >
220 {
221 private:
222 
223     typedef storage1< A1 > base_type;
224 
225 public:
226 
list1(A1 a1)227     explicit list1( A1 a1 ): base_type( a1 ) {}
228 
operator [](boost::arg<1>) const229     A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
230 
operator [](boost::arg<1> (*)()) const231     A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
232 
operator [](_bi::value<T> & v) const233     template<class T> T & operator[] ( _bi::value<T> & v ) const { return v.get(); }
234 
operator [](_bi::value<T> const & v) const235     template<class T> T const & operator[] ( _bi::value<T> const & v ) const { return v.get(); }
236 
operator [](reference_wrapper<T> const & v) const237     template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
238 
operator [](bind_t<R,F,L> & b) const239     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); }
240 
operator [](bind_t<R,F,L> const & b) const241     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); }
242 
243     template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
244     {
245         return unwrapper<F>::unwrap(f, 0)(a[base_type::a1_]);
246     }
247 
248     template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
249     {
250         return unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_]);
251     }
252 
operator ()(type<void>,F & f,A & a,int)253     template<class F, class A> void operator()(type<void>, F & f, A & a, int)
254     {
255         unwrapper<F>::unwrap(f, 0)(a[base_type::a1_]);
256     }
257 
operator ()(type<void>,F const & f,A & a,int) const258     template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
259     {
260         unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_]);
261     }
262 
accept(V & v) const263     template<class V> void accept(V & v) const
264     {
265         base_type::accept(v);
266     }
267 
operator ==(list1 const & rhs) const268     bool operator==(list1 const & rhs) const
269     {
270         return ref_compare(base_type::a1_, rhs.a1_, 0);
271     }
272 };
273 
274 struct logical_and;
275 struct logical_or;
276 
277 template< class A1, class A2 > class list2: private storage2< A1, A2 >
278 {
279 private:
280 
281     typedef storage2< A1, A2 > base_type;
282 
283 public:
284 
list2(A1 a1,A2 a2)285     list2( A1 a1, A2 a2 ): base_type( a1, a2 ) {}
286 
operator [](boost::arg<1>) const287     A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
operator [](boost::arg<2>) const288     A2 operator[] (boost::arg<2>) const { return base_type::a2_; }
289 
operator [](boost::arg<1> (*)()) const290     A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
operator [](boost::arg<2> (*)()) const291     A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; }
292 
operator [](_bi::value<T> & v) const293     template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
294 
operator [](_bi::value<T> const & v) const295     template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
296 
operator [](reference_wrapper<T> const & v) const297     template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
298 
operator [](bind_t<R,F,L> & b) const299     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); }
300 
operator [](bind_t<R,F,L> const & b) const301     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); }
302 
303     template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
304     {
305         return unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]);
306     }
307 
308     template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
309     {
310         return unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]);
311     }
312 
operator ()(type<void>,F & f,A & a,int)313     template<class F, class A> void operator()(type<void>, F & f, A & a, int)
314     {
315         unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]);
316     }
317 
operator ()(type<void>,F const & f,A & a,int) const318     template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
319     {
320         unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]);
321     }
322 
operator ()(type<bool>,logical_and &,A & a,int)323     template<class A> bool operator()( type<bool>, logical_and & /*f*/, A & a, int )
324     {
325         return a[ base_type::a1_ ] && a[ base_type::a2_ ];
326     }
327 
operator ()(type<bool>,logical_and const &,A & a,int) const328     template<class A> bool operator()( type<bool>, logical_and const & /*f*/, A & a, int ) const
329     {
330         return a[ base_type::a1_ ] && a[ base_type::a2_ ];
331     }
332 
operator ()(type<bool>,logical_or &,A & a,int)333     template<class A> bool operator()( type<bool>, logical_or & /*f*/, A & a, int )
334     {
335         return a[ base_type::a1_ ] || a[ base_type::a2_ ];
336     }
337 
operator ()(type<bool>,logical_or const &,A & a,int) const338     template<class A> bool operator()( type<bool>, logical_or const & /*f*/, A & a, int ) const
339     {
340         return a[ base_type::a1_ ] || a[ base_type::a2_ ];
341     }
342 
accept(V & v) const343     template<class V> void accept(V & v) const
344     {
345         base_type::accept(v);
346     }
347 
operator ==(list2 const & rhs) const348     bool operator==(list2 const & rhs) const
349     {
350         return ref_compare(base_type::a1_, rhs.a1_, 0) && ref_compare(base_type::a2_, rhs.a2_, 0);
351     }
352 };
353 
354 template< class A1, class A2, class A3 > class list3: private storage3< A1, A2, A3 >
355 {
356 private:
357 
358     typedef storage3< A1, A2, A3 > base_type;
359 
360 public:
361 
list3(A1 a1,A2 a2,A3 a3)362     list3( A1 a1, A2 a2, A3 a3 ): base_type( a1, a2, a3 ) {}
363 
operator [](boost::arg<1>) const364     A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
operator [](boost::arg<2>) const365     A2 operator[] (boost::arg<2>) const { return base_type::a2_; }
operator [](boost::arg<3>) const366     A3 operator[] (boost::arg<3>) const { return base_type::a3_; }
367 
operator [](boost::arg<1> (*)()) const368     A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
operator [](boost::arg<2> (*)()) const369     A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; }
operator [](boost::arg<3> (*)()) const370     A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; }
371 
operator [](_bi::value<T> & v) const372     template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
373 
operator [](_bi::value<T> const & v) const374     template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
375 
operator [](reference_wrapper<T> const & v) const376     template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
377 
operator [](bind_t<R,F,L> & b) const378     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); }
379 
operator [](bind_t<R,F,L> const & b) const380     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); }
381 
382     template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
383     {
384         return unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]);
385     }
386 
387     template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
388     {
389         return unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]);
390     }
391 
operator ()(type<void>,F & f,A & a,int)392     template<class F, class A> void operator()(type<void>, F & f, A & a, int)
393     {
394         unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]);
395     }
396 
operator ()(type<void>,F const & f,A & a,int) const397     template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
398     {
399         unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]);
400     }
401 
accept(V & v) const402     template<class V> void accept(V & v) const
403     {
404         base_type::accept(v);
405     }
406 
operator ==(list3 const & rhs) const407     bool operator==(list3 const & rhs) const
408     {
409         return
410 
411             ref_compare( base_type::a1_, rhs.a1_, 0 ) &&
412             ref_compare( base_type::a2_, rhs.a2_, 0 ) &&
413             ref_compare( base_type::a3_, rhs.a3_, 0 );
414     }
415 };
416 
417 template< class A1, class A2, class A3, class A4 > class list4: private storage4< A1, A2, A3, A4 >
418 {
419 private:
420 
421     typedef storage4< A1, A2, A3, A4 > base_type;
422 
423 public:
424 
list4(A1 a1,A2 a2,A3 a3,A4 a4)425     list4( A1 a1, A2 a2, A3 a3, A4 a4 ): base_type( a1, a2, a3, a4 ) {}
426 
operator [](boost::arg<1>) const427     A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
operator [](boost::arg<2>) const428     A2 operator[] (boost::arg<2>) const { return base_type::a2_; }
operator [](boost::arg<3>) const429     A3 operator[] (boost::arg<3>) const { return base_type::a3_; }
operator [](boost::arg<4>) const430     A4 operator[] (boost::arg<4>) const { return base_type::a4_; }
431 
operator [](boost::arg<1> (*)()) const432     A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
operator [](boost::arg<2> (*)()) const433     A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; }
operator [](boost::arg<3> (*)()) const434     A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; }
operator [](boost::arg<4> (*)()) const435     A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; }
436 
operator [](_bi::value<T> & v) const437     template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
438 
operator [](_bi::value<T> const & v) const439     template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
440 
operator [](reference_wrapper<T> const & v) const441     template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
442 
operator [](bind_t<R,F,L> & b) const443     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); }
444 
operator [](bind_t<R,F,L> const & b) const445     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); }
446 
447     template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
448     {
449         return unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]);
450     }
451 
452     template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
453     {
454         return unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]);
455     }
456 
operator ()(type<void>,F & f,A & a,int)457     template<class F, class A> void operator()(type<void>, F & f, A & a, int)
458     {
459         unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]);
460     }
461 
operator ()(type<void>,F const & f,A & a,int) const462     template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
463     {
464         unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]);
465     }
466 
accept(V & v) const467     template<class V> void accept(V & v) const
468     {
469         base_type::accept(v);
470     }
471 
operator ==(list4 const & rhs) const472     bool operator==(list4 const & rhs) const
473     {
474         return
475 
476             ref_compare( base_type::a1_, rhs.a1_, 0 ) &&
477             ref_compare( base_type::a2_, rhs.a2_, 0 ) &&
478             ref_compare( base_type::a3_, rhs.a3_, 0 ) &&
479             ref_compare( base_type::a4_, rhs.a4_, 0 );
480     }
481 };
482 
483 template< class A1, class A2, class A3, class A4, class A5 > class list5: private storage5< A1, A2, A3, A4, A5 >
484 {
485 private:
486 
487     typedef storage5< A1, A2, A3, A4, A5 > base_type;
488 
489 public:
490 
list5(A1 a1,A2 a2,A3 a3,A4 a4,A5 a5)491     list5( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5 ): base_type( a1, a2, a3, a4, a5 ) {}
492 
operator [](boost::arg<1>) const493     A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
operator [](boost::arg<2>) const494     A2 operator[] (boost::arg<2>) const { return base_type::a2_; }
operator [](boost::arg<3>) const495     A3 operator[] (boost::arg<3>) const { return base_type::a3_; }
operator [](boost::arg<4>) const496     A4 operator[] (boost::arg<4>) const { return base_type::a4_; }
operator [](boost::arg<5>) const497     A5 operator[] (boost::arg<5>) const { return base_type::a5_; }
498 
operator [](boost::arg<1> (*)()) const499     A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
operator [](boost::arg<2> (*)()) const500     A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; }
operator [](boost::arg<3> (*)()) const501     A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; }
operator [](boost::arg<4> (*)()) const502     A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; }
operator [](boost::arg<5> (*)()) const503     A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; }
504 
operator [](_bi::value<T> & v) const505     template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
506 
operator [](_bi::value<T> const & v) const507     template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
508 
operator [](reference_wrapper<T> const & v) const509     template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
510 
operator [](bind_t<R,F,L> & b) const511     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); }
512 
operator [](bind_t<R,F,L> const & b) const513     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); }
514 
515     template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
516     {
517         return unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_]);
518     }
519 
520     template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
521     {
522         return unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_]);
523     }
524 
operator ()(type<void>,F & f,A & a,int)525     template<class F, class A> void operator()(type<void>, F & f, A & a, int)
526     {
527         unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_]);
528     }
529 
operator ()(type<void>,F const & f,A & a,int) const530     template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
531     {
532         unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_]);
533     }
534 
accept(V & v) const535     template<class V> void accept(V & v) const
536     {
537         base_type::accept(v);
538     }
539 
operator ==(list5 const & rhs) const540     bool operator==(list5 const & rhs) const
541     {
542         return
543 
544             ref_compare( base_type::a1_, rhs.a1_, 0 ) &&
545             ref_compare( base_type::a2_, rhs.a2_, 0 ) &&
546             ref_compare( base_type::a3_, rhs.a3_, 0 ) &&
547             ref_compare( base_type::a4_, rhs.a4_, 0 ) &&
548             ref_compare( base_type::a5_, rhs.a5_, 0 );
549     }
550 };
551 
552 template<class A1, class A2, class A3, class A4, class A5, class A6> class list6: private storage6< A1, A2, A3, A4, A5, A6 >
553 {
554 private:
555 
556     typedef storage6< A1, A2, A3, A4, A5, A6 > base_type;
557 
558 public:
559 
list6(A1 a1,A2 a2,A3 a3,A4 a4,A5 a5,A6 a6)560     list6( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6 ): base_type( a1, a2, a3, a4, a5, a6 ) {}
561 
operator [](boost::arg<1>) const562     A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
operator [](boost::arg<2>) const563     A2 operator[] (boost::arg<2>) const { return base_type::a2_; }
operator [](boost::arg<3>) const564     A3 operator[] (boost::arg<3>) const { return base_type::a3_; }
operator [](boost::arg<4>) const565     A4 operator[] (boost::arg<4>) const { return base_type::a4_; }
operator [](boost::arg<5>) const566     A5 operator[] (boost::arg<5>) const { return base_type::a5_; }
operator [](boost::arg<6>) const567     A6 operator[] (boost::arg<6>) const { return base_type::a6_; }
568 
operator [](boost::arg<1> (*)()) const569     A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
operator [](boost::arg<2> (*)()) const570     A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; }
operator [](boost::arg<3> (*)()) const571     A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; }
operator [](boost::arg<4> (*)()) const572     A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; }
operator [](boost::arg<5> (*)()) const573     A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; }
operator [](boost::arg<6> (*)()) const574     A6 operator[] (boost::arg<6> (*) ()) const { return base_type::a6_; }
575 
operator [](_bi::value<T> & v) const576     template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
577 
operator [](_bi::value<T> const & v) const578     template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
579 
operator [](reference_wrapper<T> const & v) const580     template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
581 
operator [](bind_t<R,F,L> & b) const582     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); }
583 
operator [](bind_t<R,F,L> const & b) const584     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); }
585 
586     template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
587     {
588         return unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_]);
589     }
590 
591     template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
592     {
593         return unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_]);
594     }
595 
operator ()(type<void>,F & f,A & a,int)596     template<class F, class A> void operator()(type<void>, F & f, A & a, int)
597     {
598         unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_]);
599     }
600 
operator ()(type<void>,F const & f,A & a,int) const601     template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
602     {
603         unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_]);
604     }
605 
accept(V & v) const606     template<class V> void accept(V & v) const
607     {
608         base_type::accept(v);
609     }
610 
operator ==(list6 const & rhs) const611     bool operator==(list6 const & rhs) const
612     {
613         return
614 
615             ref_compare( base_type::a1_, rhs.a1_, 0 ) &&
616             ref_compare( base_type::a2_, rhs.a2_, 0 ) &&
617             ref_compare( base_type::a3_, rhs.a3_, 0 ) &&
618             ref_compare( base_type::a4_, rhs.a4_, 0 ) &&
619             ref_compare( base_type::a5_, rhs.a5_, 0 ) &&
620             ref_compare( base_type::a6_, rhs.a6_, 0 );
621     }
622 };
623 
624 template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> class list7: private storage7< A1, A2, A3, A4, A5, A6, A7 >
625 {
626 private:
627 
628     typedef storage7< A1, A2, A3, A4, A5, A6, A7 > base_type;
629 
630 public:
631 
list7(A1 a1,A2 a2,A3 a3,A4 a4,A5 a5,A6 a6,A7 a7)632     list7( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7 ): base_type( a1, a2, a3, a4, a5, a6, a7 ) {}
633 
operator [](boost::arg<1>) const634     A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
operator [](boost::arg<2>) const635     A2 operator[] (boost::arg<2>) const { return base_type::a2_; }
operator [](boost::arg<3>) const636     A3 operator[] (boost::arg<3>) const { return base_type::a3_; }
operator [](boost::arg<4>) const637     A4 operator[] (boost::arg<4>) const { return base_type::a4_; }
operator [](boost::arg<5>) const638     A5 operator[] (boost::arg<5>) const { return base_type::a5_; }
operator [](boost::arg<6>) const639     A6 operator[] (boost::arg<6>) const { return base_type::a6_; }
operator [](boost::arg<7>) const640     A7 operator[] (boost::arg<7>) const { return base_type::a7_; }
641 
operator [](boost::arg<1> (*)()) const642     A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
operator [](boost::arg<2> (*)()) const643     A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; }
operator [](boost::arg<3> (*)()) const644     A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; }
operator [](boost::arg<4> (*)()) const645     A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; }
operator [](boost::arg<5> (*)()) const646     A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; }
operator [](boost::arg<6> (*)()) const647     A6 operator[] (boost::arg<6> (*) ()) const { return base_type::a6_; }
operator [](boost::arg<7> (*)()) const648     A7 operator[] (boost::arg<7> (*) ()) const { return base_type::a7_; }
649 
operator [](_bi::value<T> & v) const650     template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
651 
operator [](_bi::value<T> const & v) const652     template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
653 
operator [](reference_wrapper<T> const & v) const654     template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
655 
operator [](bind_t<R,F,L> & b) const656     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); }
657 
operator [](bind_t<R,F,L> const & b) const658     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); }
659 
660     template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
661     {
662         return unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_]);
663     }
664 
665     template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
666     {
667         return unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_]);
668     }
669 
operator ()(type<void>,F & f,A & a,int)670     template<class F, class A> void operator()(type<void>, F & f, A & a, int)
671     {
672         unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_]);
673     }
674 
operator ()(type<void>,F const & f,A & a,int) const675     template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
676     {
677         unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_]);
678     }
679 
accept(V & v) const680     template<class V> void accept(V & v) const
681     {
682         base_type::accept(v);
683     }
684 
operator ==(list7 const & rhs) const685     bool operator==(list7 const & rhs) const
686     {
687         return
688 
689             ref_compare( base_type::a1_, rhs.a1_, 0 ) &&
690             ref_compare( base_type::a2_, rhs.a2_, 0 ) &&
691             ref_compare( base_type::a3_, rhs.a3_, 0 ) &&
692             ref_compare( base_type::a4_, rhs.a4_, 0 ) &&
693             ref_compare( base_type::a5_, rhs.a5_, 0 ) &&
694             ref_compare( base_type::a6_, rhs.a6_, 0 ) &&
695             ref_compare( base_type::a7_, rhs.a7_, 0 );
696     }
697 };
698 
699 template< class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8 > class list8: private storage8< A1, A2, A3, A4, A5, A6, A7, A8 >
700 {
701 private:
702 
703     typedef storage8< A1, A2, A3, A4, A5, A6, A7, A8 > base_type;
704 
705 public:
706 
list8(A1 a1,A2 a2,A3 a3,A4 a4,A5 a5,A6 a6,A7 a7,A8 a8)707     list8( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8 ): base_type( a1, a2, a3, a4, a5, a6, a7, a8 ) {}
708 
operator [](boost::arg<1>) const709     A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
operator [](boost::arg<2>) const710     A2 operator[] (boost::arg<2>) const { return base_type::a2_; }
operator [](boost::arg<3>) const711     A3 operator[] (boost::arg<3>) const { return base_type::a3_; }
operator [](boost::arg<4>) const712     A4 operator[] (boost::arg<4>) const { return base_type::a4_; }
operator [](boost::arg<5>) const713     A5 operator[] (boost::arg<5>) const { return base_type::a5_; }
operator [](boost::arg<6>) const714     A6 operator[] (boost::arg<6>) const { return base_type::a6_; }
operator [](boost::arg<7>) const715     A7 operator[] (boost::arg<7>) const { return base_type::a7_; }
operator [](boost::arg<8>) const716     A8 operator[] (boost::arg<8>) const { return base_type::a8_; }
717 
operator [](boost::arg<1> (*)()) const718     A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
operator [](boost::arg<2> (*)()) const719     A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; }
operator [](boost::arg<3> (*)()) const720     A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; }
operator [](boost::arg<4> (*)()) const721     A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; }
operator [](boost::arg<5> (*)()) const722     A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; }
operator [](boost::arg<6> (*)()) const723     A6 operator[] (boost::arg<6> (*) ()) const { return base_type::a6_; }
operator [](boost::arg<7> (*)()) const724     A7 operator[] (boost::arg<7> (*) ()) const { return base_type::a7_; }
operator [](boost::arg<8> (*)()) const725     A8 operator[] (boost::arg<8> (*) ()) const { return base_type::a8_; }
726 
operator [](_bi::value<T> & v) const727     template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
728 
operator [](_bi::value<T> const & v) const729     template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
730 
operator [](reference_wrapper<T> const & v) const731     template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
732 
operator [](bind_t<R,F,L> & b) const733     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); }
734 
operator [](bind_t<R,F,L> const & b) const735     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); }
736 
737     template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
738     {
739         return unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_]);
740     }
741 
742     template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
743     {
744         return unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_]);
745     }
746 
operator ()(type<void>,F & f,A & a,int)747     template<class F, class A> void operator()(type<void>, F & f, A & a, int)
748     {
749         unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_]);
750     }
751 
operator ()(type<void>,F const & f,A & a,int) const752     template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
753     {
754         unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_]);
755     }
756 
accept(V & v) const757     template<class V> void accept(V & v) const
758     {
759         base_type::accept(v);
760     }
761 
operator ==(list8 const & rhs) const762     bool operator==(list8 const & rhs) const
763     {
764         return
765 
766             ref_compare( base_type::a1_, rhs.a1_, 0 ) &&
767             ref_compare( base_type::a2_, rhs.a2_, 0 ) &&
768             ref_compare( base_type::a3_, rhs.a3_, 0 ) &&
769             ref_compare( base_type::a4_, rhs.a4_, 0 ) &&
770             ref_compare( base_type::a5_, rhs.a5_, 0 ) &&
771             ref_compare( base_type::a6_, rhs.a6_, 0 ) &&
772             ref_compare( base_type::a7_, rhs.a7_, 0 ) &&
773             ref_compare( base_type::a8_, rhs.a8_, 0 );
774     }
775 };
776 
777 template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> class list9: private storage9< A1, A2, A3, A4, A5, A6, A7, A8, A9 >
778 {
779 private:
780 
781     typedef storage9< A1, A2, A3, A4, A5, A6, A7, A8, A9 > base_type;
782 
783 public:
784 
list9(A1 a1,A2 a2,A3 a3,A4 a4,A5 a5,A6 a6,A7 a7,A8 a8,A9 a9)785     list9( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9 ): base_type( a1, a2, a3, a4, a5, a6, a7, a8, a9 ) {}
786 
operator [](boost::arg<1>) const787     A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
operator [](boost::arg<2>) const788     A2 operator[] (boost::arg<2>) const { return base_type::a2_; }
operator [](boost::arg<3>) const789     A3 operator[] (boost::arg<3>) const { return base_type::a3_; }
operator [](boost::arg<4>) const790     A4 operator[] (boost::arg<4>) const { return base_type::a4_; }
operator [](boost::arg<5>) const791     A5 operator[] (boost::arg<5>) const { return base_type::a5_; }
operator [](boost::arg<6>) const792     A6 operator[] (boost::arg<6>) const { return base_type::a6_; }
operator [](boost::arg<7>) const793     A7 operator[] (boost::arg<7>) const { return base_type::a7_; }
operator [](boost::arg<8>) const794     A8 operator[] (boost::arg<8>) const { return base_type::a8_; }
operator [](boost::arg<9>) const795     A9 operator[] (boost::arg<9>) const { return base_type::a9_; }
796 
operator [](boost::arg<1> (*)()) const797     A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
operator [](boost::arg<2> (*)()) const798     A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; }
operator [](boost::arg<3> (*)()) const799     A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; }
operator [](boost::arg<4> (*)()) const800     A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; }
operator [](boost::arg<5> (*)()) const801     A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; }
operator [](boost::arg<6> (*)()) const802     A6 operator[] (boost::arg<6> (*) ()) const { return base_type::a6_; }
operator [](boost::arg<7> (*)()) const803     A7 operator[] (boost::arg<7> (*) ()) const { return base_type::a7_; }
operator [](boost::arg<8> (*)()) const804     A8 operator[] (boost::arg<8> (*) ()) const { return base_type::a8_; }
operator [](boost::arg<9> (*)()) const805     A9 operator[] (boost::arg<9> (*) ()) const { return base_type::a9_; }
806 
operator [](_bi::value<T> & v) const807     template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
808 
operator [](_bi::value<T> const & v) const809     template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
810 
operator [](reference_wrapper<T> const & v) const811     template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
812 
operator [](bind_t<R,F,L> & b) const813     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); }
814 
operator [](bind_t<R,F,L> const & b) const815     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); }
816 
817     template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
818     {
819         return unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_], a[base_type::a9_]);
820     }
821 
822     template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
823     {
824         return unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_], a[base_type::a9_]);
825     }
826 
operator ()(type<void>,F & f,A & a,int)827     template<class F, class A> void operator()(type<void>, F & f, A & a, int)
828     {
829         unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_], a[base_type::a9_]);
830     }
831 
operator ()(type<void>,F const & f,A & a,int) const832     template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
833     {
834         unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_], a[base_type::a9_]);
835     }
836 
accept(V & v) const837     template<class V> void accept(V & v) const
838     {
839         base_type::accept(v);
840     }
841 
operator ==(list9 const & rhs) const842     bool operator==(list9 const & rhs) const
843     {
844         return
845 
846             ref_compare( base_type::a1_, rhs.a1_, 0 ) &&
847             ref_compare( base_type::a2_, rhs.a2_, 0 ) &&
848             ref_compare( base_type::a3_, rhs.a3_, 0 ) &&
849             ref_compare( base_type::a4_, rhs.a4_, 0 ) &&
850             ref_compare( base_type::a5_, rhs.a5_, 0 ) &&
851             ref_compare( base_type::a6_, rhs.a6_, 0 ) &&
852             ref_compare( base_type::a7_, rhs.a7_, 0 ) &&
853             ref_compare( base_type::a8_, rhs.a8_, 0 ) &&
854             ref_compare( base_type::a9_, rhs.a9_, 0 );
855     }
856 };
857 
858 #ifdef BOOST_MSVC
859 #pragma warning(pop)
860 #endif
861 
862 // bind_t
863 
864 #if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
865 
866 template< class A > struct list_add_cref
867 {
868     typedef A const & type;
869 };
870 
871 template< class A > struct list_add_cref< A& >
872 {
873     typedef A & type;
874 };
875 
876 template<class R, class F, class L> class bind_t
877 {
878 private:
879 
880     F f_;
881     L l_;
882 
883 public:
884 
885     typedef typename result_traits<R, F>::type result_type;
886     typedef bind_t this_type;
887 
bind_t(F f,L const & l)888     bind_t( F f, L const & l ): f_( f ), l_( l ) {}
889 
890     //
891 
operator ()()892     result_type operator()()
893     {
894         list0 a;
895         return l_( type<result_type>(), f_, a, 0 );
896     }
897 
operator ()() const898     result_type operator()() const
899     {
900         list0 a;
901         return l_( type<result_type>(), f_, a, 0 );
902     }
903 
operator ()(A1 && a1)904     template<class A1> result_type operator()( A1 && a1 )
905     {
906         list1< typename list_add_cref<A1>::type > a( a1 );
907         return l_( type<result_type>(), f_, a, 0 );
908     }
909 
operator ()(A1 && a1) const910     template<class A1> result_type operator()( A1 && a1 ) const
911     {
912         list1< typename list_add_cref<A1>::type > a( a1 );
913         return l_(type<result_type>(), f_, a, 0);
914     }
915 
operator ()(A1 && a1,A2 && a2)916     template<class A1, class A2> result_type operator()( A1 && a1, A2 && a2 )
917     {
918         list2< typename list_add_cref<A1>::type, typename list_add_cref<A2>::type > a( a1, a2 );
919         return l_( type<result_type>(), f_, a, 0 );
920     }
921 
operator ()(A1 && a1,A2 && a2) const922     template<class A1, class A2> result_type operator()( A1 && a1, A2 && a2 ) const
923     {
924         list2< typename list_add_cref<A1>::type, typename list_add_cref<A2>::type > a( a1, a2 );
925         return l_( type<result_type>(), f_, a, 0 );
926     }
927 
operator ()(A1 && a1,A2 && a2,A3 && a3)928     template<class A1, class A2, class A3> result_type operator()( A1 && a1, A2 && a2, A3 && a3 )
929     {
930         list3<
931             typename list_add_cref<A1>::type,
932             typename list_add_cref<A2>::type,
933             typename list_add_cref<A3>::type
934         > a( a1, a2, a3 );
935 
936         return l_( type<result_type>(), f_, a, 0 );
937     }
938 
operator ()(A1 && a1,A2 && a2,A3 && a3) const939     template<class A1, class A2, class A3> result_type operator()( A1 && a1, A2 && a2, A3 && a3 ) const
940     {
941         list3<
942             typename list_add_cref<A1>::type,
943             typename list_add_cref<A2>::type,
944             typename list_add_cref<A3>::type
945         > a( a1, a2, a3 );
946 
947         return l_( type<result_type>(), f_, a, 0 );
948     }
949 
operator ()(A1 && a1,A2 && a2,A3 && a3,A4 && a4)950     template<class A1, class A2, class A3, class A4> result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4 )
951     {
952         list4<
953             typename list_add_cref<A1>::type,
954             typename list_add_cref<A2>::type,
955             typename list_add_cref<A3>::type,
956             typename list_add_cref<A4>::type
957         > a( a1, a2, a3, a4 );
958 
959         return l_( type<result_type>(), f_, a, 0 );
960     }
961 
operator ()(A1 && a1,A2 && a2,A3 && a3,A4 && a4) const962     template<class A1, class A2, class A3, class A4> result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4 ) const
963     {
964         list4<
965             typename list_add_cref<A1>::type,
966             typename list_add_cref<A2>::type,
967             typename list_add_cref<A3>::type,
968             typename list_add_cref<A4>::type
969         > a( a1, a2, a3, a4 );
970 
971         return l_( type<result_type>(), f_, a, 0 );
972     }
973 
operator ()(A1 && a1,A2 && a2,A3 && a3,A4 && a4,A5 && a5)974     template<class A1, class A2, class A3, class A4, class A5> result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5 )
975     {
976         list5<
977             typename list_add_cref<A1>::type,
978             typename list_add_cref<A2>::type,
979             typename list_add_cref<A3>::type,
980             typename list_add_cref<A4>::type,
981             typename list_add_cref<A5>::type
982         > a( a1, a2, a3, a4, a5 );
983 
984         return l_( type<result_type>(), f_, a, 0 );
985     }
986 
operator ()(A1 && a1,A2 && a2,A3 && a3,A4 && a4,A5 && a5) const987     template<class A1, class A2, class A3, class A4, class A5> result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5 ) const
988     {
989         list5<
990             typename list_add_cref<A1>::type,
991             typename list_add_cref<A2>::type,
992             typename list_add_cref<A3>::type,
993             typename list_add_cref<A4>::type,
994             typename list_add_cref<A5>::type
995         > a( a1, a2, a3, a4, a5 );
996 
997         return l_( type<result_type>(), f_, a, 0 );
998     }
999 
operator ()(A1 && a1,A2 && a2,A3 && a3,A4 && a4,A5 && a5,A6 && a6)1000     template<class A1, class A2, class A3, class A4, class A5, class A6> result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6 )
1001     {
1002         list6<
1003             typename list_add_cref<A1>::type,
1004             typename list_add_cref<A2>::type,
1005             typename list_add_cref<A3>::type,
1006             typename list_add_cref<A4>::type,
1007             typename list_add_cref<A5>::type,
1008             typename list_add_cref<A6>::type
1009         > a( a1, a2, a3, a4, a5, a6 );
1010 
1011         return l_( type<result_type>(), f_, a, 0 );
1012     }
1013 
operator ()(A1 && a1,A2 && a2,A3 && a3,A4 && a4,A5 && a5,A6 && a6) const1014     template<class A1, class A2, class A3, class A4, class A5, class A6> result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6 ) const
1015     {
1016         list6<
1017             typename list_add_cref<A1>::type,
1018             typename list_add_cref<A2>::type,
1019             typename list_add_cref<A3>::type,
1020             typename list_add_cref<A4>::type,
1021             typename list_add_cref<A5>::type,
1022             typename list_add_cref<A6>::type
1023         > a( a1, a2, a3, a4, a5, a6 );
1024 
1025         return l_( type<result_type>(), f_, a, 0 );
1026     }
1027 
operator ()(A1 && a1,A2 && a2,A3 && a3,A4 && a4,A5 && a5,A6 && a6,A7 && a7)1028     template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7 )
1029     {
1030         list7<
1031             typename list_add_cref<A1>::type,
1032             typename list_add_cref<A2>::type,
1033             typename list_add_cref<A3>::type,
1034             typename list_add_cref<A4>::type,
1035             typename list_add_cref<A5>::type,
1036             typename list_add_cref<A6>::type,
1037             typename list_add_cref<A7>::type
1038         > a( a1, a2, a3, a4, a5, a6, a7 );
1039 
1040         return l_( type<result_type>(), f_, a, 0 );
1041     }
1042 
operator ()(A1 && a1,A2 && a2,A3 && a3,A4 && a4,A5 && a5,A6 && a6,A7 && a7) const1043     template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7 ) const
1044     {
1045         list7<
1046             typename list_add_cref<A1>::type,
1047             typename list_add_cref<A2>::type,
1048             typename list_add_cref<A3>::type,
1049             typename list_add_cref<A4>::type,
1050             typename list_add_cref<A5>::type,
1051             typename list_add_cref<A6>::type,
1052             typename list_add_cref<A7>::type
1053         > a( a1, a2, a3, a4, a5, a6, a7 );
1054 
1055         return l_( type<result_type>(), f_, a, 0 );
1056     }
1057 
operator ()(A1 && a1,A2 && a2,A3 && a3,A4 && a4,A5 && a5,A6 && a6,A7 && a7,A8 && a8)1058     template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7, A8 && a8 )
1059     {
1060         list8<
1061             typename list_add_cref<A1>::type,
1062             typename list_add_cref<A2>::type,
1063             typename list_add_cref<A3>::type,
1064             typename list_add_cref<A4>::type,
1065             typename list_add_cref<A5>::type,
1066             typename list_add_cref<A6>::type,
1067             typename list_add_cref<A7>::type,
1068             typename list_add_cref<A8>::type
1069         > a( a1, a2, a3, a4, a5, a6, a7, a8 );
1070 
1071         return l_( type<result_type>(), f_, a, 0 );
1072     }
1073 
operator ()(A1 && a1,A2 && a2,A3 && a3,A4 && a4,A5 && a5,A6 && a6,A7 && a7,A8 && a8) const1074     template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7, A8 && a8 ) const
1075     {
1076         list8<
1077             typename list_add_cref<A1>::type,
1078             typename list_add_cref<A2>::type,
1079             typename list_add_cref<A3>::type,
1080             typename list_add_cref<A4>::type,
1081             typename list_add_cref<A5>::type,
1082             typename list_add_cref<A6>::type,
1083             typename list_add_cref<A7>::type,
1084             typename list_add_cref<A8>::type
1085         > a( a1, a2, a3, a4, a5, a6, a7, a8 );
1086 
1087         return l_( type<result_type>(), f_, a, 0 );
1088     }
1089 
operator ()(A1 && a1,A2 && a2,A3 && a3,A4 && a4,A5 && a5,A6 && a6,A7 && a7,A8 && a8,A9 && a9)1090     template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7, A8 && a8, A9 && a9 )
1091     {
1092         list9<
1093             typename list_add_cref<A1>::type,
1094             typename list_add_cref<A2>::type,
1095             typename list_add_cref<A3>::type,
1096             typename list_add_cref<A4>::type,
1097             typename list_add_cref<A5>::type,
1098             typename list_add_cref<A6>::type,
1099             typename list_add_cref<A7>::type,
1100             typename list_add_cref<A8>::type,
1101             typename list_add_cref<A9>::type
1102         > a( a1, a2, a3, a4, a5, a6, a7, a8, a9 );
1103 
1104         return l_( type<result_type>(), f_, a, 0 );
1105     }
1106 
operator ()(A1 && a1,A2 && a2,A3 && a3,A4 && a4,A5 && a5,A6 && a6,A7 && a7,A8 && a8,A9 && a9) const1107     template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7, A8 && a8, A9 && a9 ) const
1108     {
1109         list9<
1110             typename list_add_cref<A1>::type,
1111             typename list_add_cref<A2>::type,
1112             typename list_add_cref<A3>::type,
1113             typename list_add_cref<A4>::type,
1114             typename list_add_cref<A5>::type,
1115             typename list_add_cref<A6>::type,
1116             typename list_add_cref<A7>::type,
1117             typename list_add_cref<A8>::type,
1118             typename list_add_cref<A9>::type
1119         > a( a1, a2, a3, a4, a5, a6, a7, a8, a9 );
1120 
1121         return l_( type<result_type>(), f_, a, 0 );
1122     }
1123 
1124     //
1125 
eval(A & a)1126     template<class A> result_type eval( A & a )
1127     {
1128         return l_( type<result_type>(), f_, a, 0 );
1129     }
1130 
eval(A & a) const1131     template<class A> result_type eval( A & a ) const
1132     {
1133         return l_( type<result_type>(), f_, a, 0 );
1134     }
1135 
accept(V & v) const1136     template<class V> void accept( V & v ) const
1137     {
1138 #if !defined( BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP ) && !defined( __BORLANDC__ )
1139         using boost::visit_each;
1140 #endif
1141 
1142         BOOST_BIND_VISIT_EACH( v, f_, 0 );
1143         l_.accept( v );
1144     }
1145 
compare(this_type const & rhs) const1146     bool compare( this_type const & rhs ) const
1147     {
1148         return ref_compare( f_, rhs.f_, 0 ) && l_ == rhs.l_;
1149     }
1150 };
1151 
1152 #elif !defined( BOOST_NO_VOID_RETURNS )
1153 
1154 template<class R, class F, class L> class bind_t
1155 {
1156 public:
1157 
1158     typedef bind_t this_type;
1159 
bind_t(F f,L const & l)1160     bind_t(F f, L const & l): f_(f), l_(l) {}
1161 
1162 #define BOOST_BIND_RETURN return
1163 #include <boost/bind/bind_template.hpp>
1164 #undef BOOST_BIND_RETURN
1165 
1166 };
1167 
1168 #else // no void returns
1169 
1170 template<class R> struct bind_t_generator
1171 {
1172 
1173 template<class F, class L> class implementation
1174 {
1175 public:
1176 
1177     typedef implementation this_type;
1178 
implementation(F f,L const & l)1179     implementation(F f, L const & l): f_(f), l_(l) {}
1180 
1181 #define BOOST_BIND_RETURN return
1182 #include <boost/bind/bind_template.hpp>
1183 #undef BOOST_BIND_RETURN
1184 
1185 };
1186 
1187 };
1188 
1189 template<> struct bind_t_generator<void>
1190 {
1191 
1192 template<class F, class L> class implementation
1193 {
1194 private:
1195 
1196     typedef void R;
1197 
1198 public:
1199 
1200     typedef implementation this_type;
1201 
implementation(F f,L const & l)1202     implementation(F f, L const & l): f_(f), l_(l) {}
1203 
1204 #define BOOST_BIND_RETURN
1205 #include <boost/bind/bind_template.hpp>
1206 #undef BOOST_BIND_RETURN
1207 
1208 };
1209 
1210 };
1211 
1212 template<class R2, class F, class L> class bind_t: public bind_t_generator<R2>::BOOST_NESTED_TEMPLATE implementation<F, L>
1213 {
1214 public:
1215 
bind_t(F f,L const & l)1216     bind_t(F f, L const & l): bind_t_generator<R2>::BOOST_NESTED_TEMPLATE implementation<F, L>(f, l) {}
1217 
1218 };
1219 
1220 #endif
1221 
1222 // function_equal
1223 
1224 #ifndef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
1225 
1226 // put overloads in _bi, rely on ADL
1227 
1228 # ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
1229 
function_equal(bind_t<R,F,L> const & a,bind_t<R,F,L> const & b)1230 template<class R, class F, class L> bool function_equal( bind_t<R, F, L> const & a, bind_t<R, F, L> const & b )
1231 {
1232     return a.compare(b);
1233 }
1234 
1235 # else
1236 
function_equal_impl(bind_t<R,F,L> const & a,bind_t<R,F,L> const & b,int)1237 template<class R, class F, class L> bool function_equal_impl( bind_t<R, F, L> const & a, bind_t<R, F, L> const & b, int )
1238 {
1239     return a.compare(b);
1240 }
1241 
1242 # endif // #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
1243 
1244 #else // BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
1245 
1246 // put overloads in boost
1247 
1248 } // namespace _bi
1249 
1250 # ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
1251 
function_equal(_bi::bind_t<R,F,L> const & a,_bi::bind_t<R,F,L> const & b)1252 template<class R, class F, class L> bool function_equal( _bi::bind_t<R, F, L> const & a, _bi::bind_t<R, F, L> const & b )
1253 {
1254     return a.compare(b);
1255 }
1256 
1257 # else
1258 
function_equal_impl(_bi::bind_t<R,F,L> const & a,_bi::bind_t<R,F,L> const & b,int)1259 template<class R, class F, class L> bool function_equal_impl( _bi::bind_t<R, F, L> const & a, _bi::bind_t<R, F, L> const & b, int )
1260 {
1261     return a.compare(b);
1262 }
1263 
1264 # endif // #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
1265 
1266 namespace _bi
1267 {
1268 
1269 #endif // BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
1270 
1271 // add_value
1272 
1273 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) || (__SUNPRO_CC >= 0x530)
1274 
1275 #if defined( __BORLANDC__ ) && BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0x582) )
1276 
1277 template<class T> struct add_value
1278 {
1279     typedef _bi::value<T> type;
1280 };
1281 
1282 #else
1283 
1284 template< class T, int I > struct add_value_2
1285 {
1286     typedef boost::arg<I> type;
1287 };
1288 
1289 template< class T > struct add_value_2< T, 0 >
1290 {
1291     typedef _bi::value< T > type;
1292 };
1293 
1294 template<class T> struct add_value
1295 {
1296     typedef typename add_value_2< T, boost::is_placeholder< T >::value >::type type;
1297 };
1298 
1299 #endif
1300 
1301 template<class T> struct add_value< value<T> >
1302 {
1303     typedef _bi::value<T> type;
1304 };
1305 
1306 template<class T> struct add_value< reference_wrapper<T> >
1307 {
1308     typedef reference_wrapper<T> type;
1309 };
1310 
1311 template<int I> struct add_value< arg<I> >
1312 {
1313     typedef boost::arg<I> type;
1314 };
1315 
1316 template<int I> struct add_value< arg<I> (*) () >
1317 {
1318     typedef boost::arg<I> (*type) ();
1319 };
1320 
1321 template<class R, class F, class L> struct add_value< bind_t<R, F, L> >
1322 {
1323     typedef bind_t<R, F, L> type;
1324 };
1325 
1326 #else
1327 
1328 template<int I> struct _avt_0;
1329 
1330 template<> struct _avt_0<1>
1331 {
1332     template<class T> struct inner
1333     {
1334         typedef T type;
1335     };
1336 };
1337 
1338 template<> struct _avt_0<2>
1339 {
1340     template<class T> struct inner
1341     {
1342         typedef value<T> type;
1343     };
1344 };
1345 
1346 typedef char (&_avt_r1) [1];
1347 typedef char (&_avt_r2) [2];
1348 
1349 template<class T> _avt_r1 _avt_f(value<T>);
1350 template<class T> _avt_r1 _avt_f(reference_wrapper<T>);
1351 template<int I> _avt_r1 _avt_f(arg<I>);
1352 template<int I> _avt_r1 _avt_f(arg<I> (*) ());
1353 template<class R, class F, class L> _avt_r1 _avt_f(bind_t<R, F, L>);
1354 
1355 _avt_r2 _avt_f(...);
1356 
1357 template<class T> struct add_value
1358 {
1359     static T t();
1360     typedef typename _avt_0<sizeof(_avt_f(t()))>::template inner<T>::type type;
1361 };
1362 
1363 #endif
1364 
1365 // list_av_N
1366 
1367 template<class A1> struct list_av_1
1368 {
1369     typedef typename add_value<A1>::type B1;
1370     typedef list1<B1> type;
1371 };
1372 
1373 template<class A1, class A2> struct list_av_2
1374 {
1375     typedef typename add_value<A1>::type B1;
1376     typedef typename add_value<A2>::type B2;
1377     typedef list2<B1, B2> type;
1378 };
1379 
1380 template<class A1, class A2, class A3> struct list_av_3
1381 {
1382     typedef typename add_value<A1>::type B1;
1383     typedef typename add_value<A2>::type B2;
1384     typedef typename add_value<A3>::type B3;
1385     typedef list3<B1, B2, B3> type;
1386 };
1387 
1388 template<class A1, class A2, class A3, class A4> struct list_av_4
1389 {
1390     typedef typename add_value<A1>::type B1;
1391     typedef typename add_value<A2>::type B2;
1392     typedef typename add_value<A3>::type B3;
1393     typedef typename add_value<A4>::type B4;
1394     typedef list4<B1, B2, B3, B4> type;
1395 };
1396 
1397 template<class A1, class A2, class A3, class A4, class A5> struct list_av_5
1398 {
1399     typedef typename add_value<A1>::type B1;
1400     typedef typename add_value<A2>::type B2;
1401     typedef typename add_value<A3>::type B3;
1402     typedef typename add_value<A4>::type B4;
1403     typedef typename add_value<A5>::type B5;
1404     typedef list5<B1, B2, B3, B4, B5> type;
1405 };
1406 
1407 template<class A1, class A2, class A3, class A4, class A5, class A6> struct list_av_6
1408 {
1409     typedef typename add_value<A1>::type B1;
1410     typedef typename add_value<A2>::type B2;
1411     typedef typename add_value<A3>::type B3;
1412     typedef typename add_value<A4>::type B4;
1413     typedef typename add_value<A5>::type B5;
1414     typedef typename add_value<A6>::type B6;
1415     typedef list6<B1, B2, B3, B4, B5, B6> type;
1416 };
1417 
1418 template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> struct list_av_7
1419 {
1420     typedef typename add_value<A1>::type B1;
1421     typedef typename add_value<A2>::type B2;
1422     typedef typename add_value<A3>::type B3;
1423     typedef typename add_value<A4>::type B4;
1424     typedef typename add_value<A5>::type B5;
1425     typedef typename add_value<A6>::type B6;
1426     typedef typename add_value<A7>::type B7;
1427     typedef list7<B1, B2, B3, B4, B5, B6, B7> type;
1428 };
1429 
1430 template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> struct list_av_8
1431 {
1432     typedef typename add_value<A1>::type B1;
1433     typedef typename add_value<A2>::type B2;
1434     typedef typename add_value<A3>::type B3;
1435     typedef typename add_value<A4>::type B4;
1436     typedef typename add_value<A5>::type B5;
1437     typedef typename add_value<A6>::type B6;
1438     typedef typename add_value<A7>::type B7;
1439     typedef typename add_value<A8>::type B8;
1440     typedef list8<B1, B2, B3, B4, B5, B6, B7, B8> type;
1441 };
1442 
1443 template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> struct list_av_9
1444 {
1445     typedef typename add_value<A1>::type B1;
1446     typedef typename add_value<A2>::type B2;
1447     typedef typename add_value<A3>::type B3;
1448     typedef typename add_value<A4>::type B4;
1449     typedef typename add_value<A5>::type B5;
1450     typedef typename add_value<A6>::type B6;
1451     typedef typename add_value<A7>::type B7;
1452     typedef typename add_value<A8>::type B8;
1453     typedef typename add_value<A9>::type B9;
1454     typedef list9<B1, B2, B3, B4, B5, B6, B7, B8, B9> type;
1455 };
1456 
1457 // operator!
1458 
1459 struct logical_not
1460 {
operator ()boost::_bi::logical_not1461     template<class V> bool operator()(V const & v) const { return !v; }
1462 };
1463 
1464 template<class R, class F, class L>
1465     bind_t< bool, logical_not, list1< bind_t<R, F, L> > >
operator !(bind_t<R,F,L> const & f)1466     operator! (bind_t<R, F, L> const & f)
1467 {
1468     typedef list1< bind_t<R, F, L> > list_type;
1469     return bind_t<bool, logical_not, list_type> ( logical_not(), list_type(f) );
1470 }
1471 
1472 // relational operators
1473 
1474 #define BOOST_BIND_OPERATOR( op, name ) \
1475 \
1476 struct name \
1477 { \
1478     template<class V, class W> bool operator()(V const & v, W const & w) const { return v op w; } \
1479 }; \
1480  \
1481 template<class R, class F, class L, class A2> \
1482     bind_t< bool, name, list2< bind_t<R, F, L>, typename add_value<A2>::type > > \
1483     operator op (bind_t<R, F, L> const & f, A2 a2) \
1484 { \
1485     typedef typename add_value<A2>::type B2; \
1486     typedef list2< bind_t<R, F, L>, B2> list_type; \
1487     return bind_t<bool, name, list_type> ( name(), list_type(f, a2) ); \
1488 }
1489 
1490 BOOST_BIND_OPERATOR( ==, equal )
1491 BOOST_BIND_OPERATOR( !=, not_equal )
1492 
1493 BOOST_BIND_OPERATOR( <, less )
1494 BOOST_BIND_OPERATOR( <=, less_equal )
1495 
1496 BOOST_BIND_OPERATOR( >, greater )
1497 BOOST_BIND_OPERATOR( >=, greater_equal )
1498 
1499 BOOST_BIND_OPERATOR( &&, logical_and )
1500 BOOST_BIND_OPERATOR( ||, logical_or )
1501 
1502 #undef BOOST_BIND_OPERATOR
1503 
1504 #if defined(__GNUC__) && BOOST_WORKAROUND(__GNUC__, < 3)
1505 
1506 // resolve ambiguity with rel_ops
1507 
1508 #define BOOST_BIND_OPERATOR( op, name ) \
1509 \
1510 template<class R, class F, class L> \
1511     bind_t< bool, name, list2< bind_t<R, F, L>, bind_t<R, F, L> > > \
1512     operator op (bind_t<R, F, L> const & f, bind_t<R, F, L> const & g) \
1513 { \
1514     typedef list2< bind_t<R, F, L>, bind_t<R, F, L> > list_type; \
1515     return bind_t<bool, name, list_type> ( name(), list_type(f, g) ); \
1516 }
1517 
1518 BOOST_BIND_OPERATOR( !=, not_equal )
1519 BOOST_BIND_OPERATOR( <=, less_equal )
1520 BOOST_BIND_OPERATOR( >, greater )
1521 BOOST_BIND_OPERATOR( >=, greater_equal )
1522 
1523 #endif
1524 
1525 // visit_each, ADL
1526 
1527 #if !defined( BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP ) && !defined( __BORLANDC__ ) \
1528    && !(defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ <= 3)
1529 
visit_each(V & v,value<T> const & t,int)1530 template<class V, class T> void visit_each( V & v, value<T> const & t, int )
1531 {
1532     using boost::visit_each;
1533     BOOST_BIND_VISIT_EACH( v, t.get(), 0 );
1534 }
1535 
visit_each(V & v,bind_t<R,F,L> const & t,int)1536 template<class V, class R, class F, class L> void visit_each( V & v, bind_t<R, F, L> const & t, int )
1537 {
1538     t.accept( v );
1539 }
1540 
1541 #endif
1542 
1543 } // namespace _bi
1544 
1545 // visit_each, no ADL
1546 
1547 #if defined( BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP ) || defined( __BORLANDC__ ) \
1548   || (defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ <= 3)
1549 
visit_each(V & v,_bi::value<T> const & t,int)1550 template<class V, class T> void visit_each( V & v, _bi::value<T> const & t, int )
1551 {
1552     BOOST_BIND_VISIT_EACH( v, t.get(), 0 );
1553 }
1554 
visit_each(V & v,_bi::bind_t<R,F,L> const & t,int)1555 template<class V, class R, class F, class L> void visit_each( V & v, _bi::bind_t<R, F, L> const & t, int )
1556 {
1557     t.accept( v );
1558 }
1559 
1560 #endif
1561 
1562 // is_bind_expression
1563 
1564 template< class T > struct is_bind_expression
1565 {
1566     enum _vt { value = 0 };
1567 };
1568 
1569 #if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
1570 
1571 template< class R, class F, class L > struct is_bind_expression< _bi::bind_t< R, F, L > >
1572 {
1573     enum _vt { value = 1 };
1574 };
1575 
1576 #endif
1577 
1578 // bind
1579 
1580 #ifndef BOOST_BIND
1581 #define BOOST_BIND bind
1582 #endif
1583 
1584 // generic function objects
1585 
1586 template<class R, class F>
1587     _bi::bind_t<R, F, _bi::list0>
BOOST_BIND(F f)1588     BOOST_BIND(F f)
1589 {
1590     typedef _bi::list0 list_type;
1591     return _bi::bind_t<R, F, list_type> (f, list_type());
1592 }
1593 
1594 template<class R, class F, class A1>
1595     _bi::bind_t<R, F, typename _bi::list_av_1<A1>::type>
BOOST_BIND(F f,A1 a1)1596     BOOST_BIND(F f, A1 a1)
1597 {
1598     typedef typename _bi::list_av_1<A1>::type list_type;
1599     return _bi::bind_t<R, F, list_type> (f, list_type(a1));
1600 }
1601 
1602 template<class R, class F, class A1, class A2>
1603     _bi::bind_t<R, F, typename _bi::list_av_2<A1, A2>::type>
BOOST_BIND(F f,A1 a1,A2 a2)1604     BOOST_BIND(F f, A1 a1, A2 a2)
1605 {
1606     typedef typename _bi::list_av_2<A1, A2>::type list_type;
1607     return _bi::bind_t<R, F, list_type> (f, list_type(a1, a2));
1608 }
1609 
1610 template<class R, class F, class A1, class A2, class A3>
1611     _bi::bind_t<R, F, typename _bi::list_av_3<A1, A2, A3>::type>
BOOST_BIND(F f,A1 a1,A2 a2,A3 a3)1612     BOOST_BIND(F f, A1 a1, A2 a2, A3 a3)
1613 {
1614     typedef typename _bi::list_av_3<A1, A2, A3>::type list_type;
1615     return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3));
1616 }
1617 
1618 template<class R, class F, class A1, class A2, class A3, class A4>
1619     _bi::bind_t<R, F, typename _bi::list_av_4<A1, A2, A3, A4>::type>
BOOST_BIND(F f,A1 a1,A2 a2,A3 a3,A4 a4)1620     BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4)
1621 {
1622     typedef typename _bi::list_av_4<A1, A2, A3, A4>::type list_type;
1623     return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4));
1624 }
1625 
1626 template<class R, class F, class A1, class A2, class A3, class A4, class A5>
1627     _bi::bind_t<R, F, typename _bi::list_av_5<A1, A2, A3, A4, A5>::type>
BOOST_BIND(F f,A1 a1,A2 a2,A3 a3,A4 a4,A5 a5)1628     BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5)
1629 {
1630     typedef typename _bi::list_av_5<A1, A2, A3, A4, A5>::type list_type;
1631     return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5));
1632 }
1633 
1634 template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6>
1635     _bi::bind_t<R, F, typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type>
BOOST_BIND(F f,A1 a1,A2 a2,A3 a3,A4 a4,A5 a5,A6 a6)1636     BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6)
1637 {
1638     typedef typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type list_type;
1639     return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6));
1640 }
1641 
1642 template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7>
1643     _bi::bind_t<R, F, typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type>
BOOST_BIND(F f,A1 a1,A2 a2,A3 a3,A4 a4,A5 a5,A6 a6,A7 a7)1644     BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7)
1645 {
1646     typedef typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type list_type;
1647     return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7));
1648 }
1649 
1650 template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
1651     _bi::bind_t<R, F, typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type>
BOOST_BIND(F f,A1 a1,A2 a2,A3 a3,A4 a4,A5 a5,A6 a6,A7 a7,A8 a8)1652     BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8)
1653 {
1654     typedef typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type list_type;
1655     return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8));
1656 }
1657 
1658 template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9>
1659     _bi::bind_t<R, F, typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type>
BOOST_BIND(F f,A1 a1,A2 a2,A3 a3,A4 a4,A5 a5,A6 a6,A7 a7,A8 a8,A9 a9)1660     BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9)
1661 {
1662     typedef typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type list_type;
1663     return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9));
1664 }
1665 
1666 // generic function objects, alternative syntax
1667 
1668 template<class R, class F>
1669     _bi::bind_t<R, F, _bi::list0>
BOOST_BIND(boost::type<R>,F f)1670     BOOST_BIND(boost::type<R>, F f)
1671 {
1672     typedef _bi::list0 list_type;
1673     return _bi::bind_t<R, F, list_type> (f, list_type());
1674 }
1675 
1676 template<class R, class F, class A1>
1677     _bi::bind_t<R, F, typename _bi::list_av_1<A1>::type>
BOOST_BIND(boost::type<R>,F f,A1 a1)1678     BOOST_BIND(boost::type<R>, F f, A1 a1)
1679 {
1680     typedef typename _bi::list_av_1<A1>::type list_type;
1681     return _bi::bind_t<R, F, list_type> (f, list_type(a1));
1682 }
1683 
1684 template<class R, class F, class A1, class A2>
1685     _bi::bind_t<R, F, typename _bi::list_av_2<A1, A2>::type>
BOOST_BIND(boost::type<R>,F f,A1 a1,A2 a2)1686     BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2)
1687 {
1688     typedef typename _bi::list_av_2<A1, A2>::type list_type;
1689     return _bi::bind_t<R, F, list_type> (f, list_type(a1, a2));
1690 }
1691 
1692 template<class R, class F, class A1, class A2, class A3>
1693     _bi::bind_t<R, F, typename _bi::list_av_3<A1, A2, A3>::type>
BOOST_BIND(boost::type<R>,F f,A1 a1,A2 a2,A3 a3)1694     BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3)
1695 {
1696     typedef typename _bi::list_av_3<A1, A2, A3>::type list_type;
1697     return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3));
1698 }
1699 
1700 template<class R, class F, class A1, class A2, class A3, class A4>
1701     _bi::bind_t<R, F, typename _bi::list_av_4<A1, A2, A3, A4>::type>
BOOST_BIND(boost::type<R>,F f,A1 a1,A2 a2,A3 a3,A4 a4)1702     BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3, A4 a4)
1703 {
1704     typedef typename _bi::list_av_4<A1, A2, A3, A4>::type list_type;
1705     return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4));
1706 }
1707 
1708 template<class R, class F, class A1, class A2, class A3, class A4, class A5>
1709     _bi::bind_t<R, F, typename _bi::list_av_5<A1, A2, A3, A4, A5>::type>
BOOST_BIND(boost::type<R>,F f,A1 a1,A2 a2,A3 a3,A4 a4,A5 a5)1710     BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5)
1711 {
1712     typedef typename _bi::list_av_5<A1, A2, A3, A4, A5>::type list_type;
1713     return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5));
1714 }
1715 
1716 template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6>
1717     _bi::bind_t<R, F, typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type>
BOOST_BIND(boost::type<R>,F f,A1 a1,A2 a2,A3 a3,A4 a4,A5 a5,A6 a6)1718     BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6)
1719 {
1720     typedef typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type list_type;
1721     return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6));
1722 }
1723 
1724 template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7>
1725     _bi::bind_t<R, F, typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type>
BOOST_BIND(boost::type<R>,F f,A1 a1,A2 a2,A3 a3,A4 a4,A5 a5,A6 a6,A7 a7)1726     BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7)
1727 {
1728     typedef typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type list_type;
1729     return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7));
1730 }
1731 
1732 template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
1733     _bi::bind_t<R, F, typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type>
BOOST_BIND(boost::type<R>,F f,A1 a1,A2 a2,A3 a3,A4 a4,A5 a5,A6 a6,A7 a7,A8 a8)1734     BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8)
1735 {
1736     typedef typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type list_type;
1737     return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8));
1738 }
1739 
1740 template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9>
1741     _bi::bind_t<R, F, typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type>
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)1742     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)
1743 {
1744     typedef typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type list_type;
1745     return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9));
1746 }
1747 
1748 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
1749 
1750 // adaptable function objects
1751 
1752 template<class F>
1753     _bi::bind_t<_bi::unspecified, F, _bi::list0>
BOOST_BIND(F f)1754     BOOST_BIND(F f)
1755 {
1756     typedef _bi::list0 list_type;
1757     return _bi::bind_t<_bi::unspecified, F, list_type> (f, list_type());
1758 }
1759 
1760 template<class F, class A1>
1761     _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_1<A1>::type>
BOOST_BIND(F f,A1 a1)1762     BOOST_BIND(F f, A1 a1)
1763 {
1764     typedef typename _bi::list_av_1<A1>::type list_type;
1765     return _bi::bind_t<_bi::unspecified, F, list_type> (f, list_type(a1));
1766 }
1767 
1768 template<class F, class A1, class A2>
1769     _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_2<A1, A2>::type>
BOOST_BIND(F f,A1 a1,A2 a2)1770     BOOST_BIND(F f, A1 a1, A2 a2)
1771 {
1772     typedef typename _bi::list_av_2<A1, A2>::type list_type;
1773     return _bi::bind_t<_bi::unspecified, F, list_type> (f, list_type(a1, a2));
1774 }
1775 
1776 template<class F, class A1, class A2, class A3>
1777     _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_3<A1, A2, A3>::type>
BOOST_BIND(F f,A1 a1,A2 a2,A3 a3)1778     BOOST_BIND(F f, A1 a1, A2 a2, A3 a3)
1779 {
1780     typedef typename _bi::list_av_3<A1, A2, A3>::type list_type;
1781     return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3));
1782 }
1783 
1784 template<class F, class A1, class A2, class A3, class A4>
1785     _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_4<A1, A2, A3, A4>::type>
BOOST_BIND(F f,A1 a1,A2 a2,A3 a3,A4 a4)1786     BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4)
1787 {
1788     typedef typename _bi::list_av_4<A1, A2, A3, A4>::type list_type;
1789     return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4));
1790 }
1791 
1792 template<class F, class A1, class A2, class A3, class A4, class A5>
1793     _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_5<A1, A2, A3, A4, A5>::type>
BOOST_BIND(F f,A1 a1,A2 a2,A3 a3,A4 a4,A5 a5)1794     BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5)
1795 {
1796     typedef typename _bi::list_av_5<A1, A2, A3, A4, A5>::type list_type;
1797     return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5));
1798 }
1799 
1800 template<class F, class A1, class A2, class A3, class A4, class A5, class A6>
1801     _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type>
BOOST_BIND(F f,A1 a1,A2 a2,A3 a3,A4 a4,A5 a5,A6 a6)1802     BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6)
1803 {
1804     typedef typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type list_type;
1805     return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6));
1806 }
1807 
1808 template<class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7>
1809     _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type>
BOOST_BIND(F f,A1 a1,A2 a2,A3 a3,A4 a4,A5 a5,A6 a6,A7 a7)1810     BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7)
1811 {
1812     typedef typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type list_type;
1813     return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7));
1814 }
1815 
1816 template<class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
1817     _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type>
BOOST_BIND(F f,A1 a1,A2 a2,A3 a3,A4 a4,A5 a5,A6 a6,A7 a7,A8 a8)1818     BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8)
1819 {
1820     typedef typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type list_type;
1821     return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8));
1822 }
1823 
1824 template<class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9>
1825     _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type>
BOOST_BIND(F f,A1 a1,A2 a2,A3 a3,A4 a4,A5 a5,A6 a6,A7 a7,A8 a8,A9 a9)1826     BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9)
1827 {
1828     typedef typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type list_type;
1829     return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9));
1830 }
1831 
1832 #endif // !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
1833 
1834 // function pointers
1835 
1836 #define BOOST_BIND_CC
1837 #define BOOST_BIND_ST
1838 
1839 #include <boost/bind/bind_cc.hpp>
1840 
1841 #undef BOOST_BIND_CC
1842 #undef BOOST_BIND_ST
1843 
1844 #ifdef BOOST_BIND_ENABLE_STDCALL
1845 
1846 #define BOOST_BIND_CC __stdcall
1847 #define BOOST_BIND_ST
1848 
1849 #include <boost/bind/bind_cc.hpp>
1850 
1851 #undef BOOST_BIND_CC
1852 #undef BOOST_BIND_ST
1853 
1854 #endif
1855 
1856 #ifdef BOOST_BIND_ENABLE_FASTCALL
1857 
1858 #define BOOST_BIND_CC __fastcall
1859 #define BOOST_BIND_ST
1860 
1861 #include <boost/bind/bind_cc.hpp>
1862 
1863 #undef BOOST_BIND_CC
1864 #undef BOOST_BIND_ST
1865 
1866 #endif
1867 
1868 #ifdef BOOST_BIND_ENABLE_PASCAL
1869 
1870 #define BOOST_BIND_ST pascal
1871 #define BOOST_BIND_CC
1872 
1873 #include <boost/bind/bind_cc.hpp>
1874 
1875 #undef BOOST_BIND_ST
1876 #undef BOOST_BIND_CC
1877 
1878 #endif
1879 
1880 // member function pointers
1881 
1882 #define BOOST_BIND_MF_NAME(X) X
1883 #define BOOST_BIND_MF_CC
1884 
1885 #include <boost/bind/bind_mf_cc.hpp>
1886 #include <boost/bind/bind_mf2_cc.hpp>
1887 
1888 #undef BOOST_BIND_MF_NAME
1889 #undef BOOST_BIND_MF_CC
1890 
1891 #ifdef BOOST_MEM_FN_ENABLE_CDECL
1892 
1893 #define BOOST_BIND_MF_NAME(X) X##_cdecl
1894 #define BOOST_BIND_MF_CC __cdecl
1895 
1896 #include <boost/bind/bind_mf_cc.hpp>
1897 #include <boost/bind/bind_mf2_cc.hpp>
1898 
1899 #undef BOOST_BIND_MF_NAME
1900 #undef BOOST_BIND_MF_CC
1901 
1902 #endif
1903 
1904 #ifdef BOOST_MEM_FN_ENABLE_STDCALL
1905 
1906 #define BOOST_BIND_MF_NAME(X) X##_stdcall
1907 #define BOOST_BIND_MF_CC __stdcall
1908 
1909 #include <boost/bind/bind_mf_cc.hpp>
1910 #include <boost/bind/bind_mf2_cc.hpp>
1911 
1912 #undef BOOST_BIND_MF_NAME
1913 #undef BOOST_BIND_MF_CC
1914 
1915 #endif
1916 
1917 #ifdef BOOST_MEM_FN_ENABLE_FASTCALL
1918 
1919 #define BOOST_BIND_MF_NAME(X) X##_fastcall
1920 #define BOOST_BIND_MF_CC __fastcall
1921 
1922 #include <boost/bind/bind_mf_cc.hpp>
1923 #include <boost/bind/bind_mf2_cc.hpp>
1924 
1925 #undef BOOST_BIND_MF_NAME
1926 #undef BOOST_BIND_MF_CC
1927 
1928 #endif
1929 
1930 // data member pointers
1931 
1932 #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) || defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \
1933     || ( defined(__BORLANDC__) && BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT( 0x620 ) ) )
1934 
1935 template<class R, class T, class A1>
1936 _bi::bind_t< R, _mfi::dm<R, T>, typename _bi::list_av_1<A1>::type >
BOOST_BIND(R T::* f,A1 a1)1937     BOOST_BIND(R T::*f, A1 a1)
1938 {
1939     typedef _mfi::dm<R, T> F;
1940     typedef typename _bi::list_av_1<A1>::type list_type;
1941     return _bi::bind_t<R, F, list_type>( F(f), list_type(a1) );
1942 }
1943 
1944 #else
1945 
1946 namespace _bi
1947 {
1948 
1949 template< class Pm, int I > struct add_cref;
1950 
1951 template< class M, class T > struct add_cref< M T::*, 0 >
1952 {
1953     typedef M type;
1954 };
1955 
1956 template< class M, class T > struct add_cref< M T::*, 1 >
1957 {
1958 #ifdef BOOST_MSVC
1959 #pragma warning(push)
1960 #pragma warning(disable:4180)
1961 #endif
1962     typedef M const & type;
1963 #ifdef BOOST_MSVC
1964 #pragma warning(pop)
1965 #endif
1966 };
1967 
1968 template< class R, class T > struct add_cref< R (T::*) (), 1 >
1969 {
1970     typedef void type;
1971 };
1972 
1973 #if !defined(__IBMCPP__) || __IBMCPP_FUNC_CV_TMPL_ARG_DEDUCTION
1974 
1975 template< class R, class T > struct add_cref< R (T::*) () const, 1 >
1976 {
1977     typedef void type;
1978 };
1979 
1980 #endif // __IBMCPP__
1981 
1982 template<class R> struct isref
1983 {
1984     enum value_type { value = 0 };
1985 };
1986 
1987 template<class R> struct isref< R& >
1988 {
1989     enum value_type { value = 1 };
1990 };
1991 
1992 template<class R> struct isref< R* >
1993 {
1994     enum value_type { value = 1 };
1995 };
1996 
1997 template<class Pm, class A1> struct dm_result
1998 {
1999     typedef typename add_cref< Pm, 1 >::type type;
2000 };
2001 
2002 template<class Pm, class R, class F, class L> struct dm_result< Pm, bind_t<R, F, L> >
2003 {
2004     typedef typename bind_t<R, F, L>::result_type result_type;
2005     typedef typename add_cref< Pm, isref< result_type >::value >::type type;
2006 };
2007 
2008 } // namespace _bi
2009 
2010 template< class A1, class M, class T >
2011 
2012 _bi::bind_t<
2013     typename _bi::dm_result< M T::*, A1 >::type,
2014     _mfi::dm<M, T>,
2015     typename _bi::list_av_1<A1>::type
2016 >
2017 
BOOST_BIND(M T::* f,A1 a1)2018 BOOST_BIND( M T::*f, A1 a1 )
2019 {
2020     typedef typename _bi::dm_result< M T::*, A1 >::type result_type;
2021     typedef _mfi::dm<M, T> F;
2022     typedef typename _bi::list_av_1<A1>::type list_type;
2023     return _bi::bind_t< result_type, F, list_type >( F( f ), list_type( a1 ) );
2024 }
2025 
2026 #endif
2027 
2028 } // namespace boost
2029 
2030 #ifndef BOOST_BIND_NO_PLACEHOLDERS
2031 
2032 # include <boost/bind/placeholders.hpp>
2033 
2034 #endif
2035 
2036 #ifdef BOOST_MSVC
2037 # pragma warning(default: 4512) // assignment operator could not be generated
2038 # pragma warning(pop)
2039 #endif
2040 
2041 #endif // #ifndef BOOST_BIND_BIND_HPP_INCLUDED
2042