1 #ifndef BOOST_BIND_BIND_HPP_INCLUDED
2 #define BOOST_BIND_BIND_HPP_INCLUDED
4 // MS compatible compilers support #pragma once
6 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
11 // bind.hpp - binds function objects to arguments
13 // Copyright (c) 2001-2004 Peter Dimov and Multi Media Ltd.
14 // Copyright (c) 2001 David Abrahams
15 // Copyright (c) 2005 Peter Dimov
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)
21 // See http://www.boost.org/libs/bind/bind.html for documentation.
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>
33 // Borland-specific bug, visit_each() silently fails to produce code
35 #if defined(__BORLANDC__)
36 # define BOOST_BIND_VISIT_EACH boost::visit_each
38 # define BOOST_BIND_VISIT_EACH visit_each
41 #include <boost/bind/storage.hpp>
44 # pragma warning(push)
45 # pragma warning(disable: 4512) // assignment operator could not be generated
51 template<class T> class weak_ptr;
53 namespace _bi // implementation details
58 template<class R, class F> struct result_traits
63 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
65 struct unspecified {};
67 template<class F> struct result_traits<unspecified, F>
69 typedef typename F::result_type type;
72 template<class F> struct result_traits< unspecified, reference_wrapper<F> >
74 typedef typename F::result_type type;
81 template<class T> bool ref_compare( T const & a, T const & b, long )
86 template<int I> bool ref_compare( arg<I> const &, arg<I> const &, int )
91 template<int I> bool ref_compare( arg<I> (*) (), arg<I> (*) (), int )
96 template<class T> bool ref_compare( reference_wrapper<T> const & a, reference_wrapper<T> const & b, int )
98 return a.get_pointer() == b.get_pointer();
101 // bind_t forward declaration for listN
103 template<class R, class F, class L> class bind_t;
105 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 )
107 return a.compare( b );
112 template<class T> class value
116 value(T const & t): t_(t) {}
118 T & get() { return t_; }
119 T const & get() const { return t_; }
121 bool operator==(value const & rhs) const
131 // ref_compare for weak_ptr
133 template<class T> bool ref_compare( value< weak_ptr<T> > const & a, value< weak_ptr<T> > const & b, int )
135 return !(a.get() < b.get()) && !(b.get() < a.get());
140 template<class T> class type {};
144 template<class F> struct unwrapper
146 static inline F & unwrap( F & f, long )
151 template<class F2> static inline F2 & unwrap( reference_wrapper<F2> rf, int )
156 template<class R, class T> static inline _mfi::dm<R, T> unwrap( R T::* pm, int )
158 return _mfi::dm<R, T>( pm );
170 template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
172 template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
174 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
176 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); }
178 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); }
180 template<class R, class F, class A> R operator()(type<R>, F & f, A &, long)
182 return unwrapper<F>::unwrap(f, 0)();
185 template<class R, class F, class A> R operator()(type<R>, F const & f, A &, long) const
187 return unwrapper<F const>::unwrap(f, 0)();
190 template<class F, class A> void operator()(type<void>, F & f, A &, int)
192 unwrapper<F>::unwrap(f, 0)();
195 template<class F, class A> void operator()(type<void>, F const & f, A &, int) const
197 unwrapper<F const>::unwrap(f, 0)();
200 template<class V> void accept(V &) const
204 bool operator==(list0 const &) const
211 // MSVC is bright enough to realise that the parameter rhs
212 // in operator==may be unused for some template argument types:
213 #pragma warning(push)
214 #pragma warning(disable:4100)
217 template< class A1 > class list1: private storage1< A1 >
221 typedef storage1< A1 > base_type;
225 explicit list1( A1 a1 ): base_type( a1 ) {}
227 A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
229 A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
231 template<class T> T & operator[] ( _bi::value<T> & v ) const { return v.get(); }
233 template<class T> T const & operator[] ( _bi::value<T> const & v ) const { return v.get(); }
235 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
237 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); }
239 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); }
241 template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
243 return unwrapper<F>::unwrap(f, 0)(a[base_type::a1_]);
246 template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
248 return unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_]);
251 template<class F, class A> void operator()(type<void>, F & f, A & a, int)
253 unwrapper<F>::unwrap(f, 0)(a[base_type::a1_]);
256 template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
258 unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_]);
261 template<class V> void accept(V & v) const
263 base_type::accept(v);
266 bool operator==(list1 const & rhs) const
268 return ref_compare(base_type::a1_, rhs.a1_, 0);
275 template< class A1, class A2 > class list2: private storage2< A1, A2 >
279 typedef storage2< A1, A2 > base_type;
283 list2( A1 a1, A2 a2 ): base_type( a1, a2 ) {}
285 A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
286 A2 operator[] (boost::arg<2>) const { return base_type::a2_; }
288 A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
289 A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; }
291 template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
293 template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
295 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
297 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); }
299 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); }
301 template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
303 return unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]);
306 template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
308 return unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]);
311 template<class F, class A> void operator()(type<void>, F & f, A & a, int)
313 unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]);
316 template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
318 unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]);
321 template<class A> bool operator()( type<bool>, logical_and & /*f*/, A & a, int )
323 return a[ base_type::a1_ ] && a[ base_type::a2_ ];
326 template<class A> bool operator()( type<bool>, logical_and const & /*f*/, A & a, int ) const
328 return a[ base_type::a1_ ] && a[ base_type::a2_ ];
331 template<class A> bool operator()( type<bool>, logical_or & /*f*/, A & a, int )
333 return a[ base_type::a1_ ] || a[ base_type::a2_ ];
336 template<class A> bool operator()( type<bool>, logical_or const & /*f*/, A & a, int ) const
338 return a[ base_type::a1_ ] || a[ base_type::a2_ ];
341 template<class V> void accept(V & v) const
343 base_type::accept(v);
346 bool operator==(list2 const & rhs) const
348 return ref_compare(base_type::a1_, rhs.a1_, 0) && ref_compare(base_type::a2_, rhs.a2_, 0);
352 template< class A1, class A2, class A3 > class list3: private storage3< A1, A2, A3 >
356 typedef storage3< A1, A2, A3 > base_type;
360 list3( A1 a1, A2 a2, A3 a3 ): base_type( a1, a2, a3 ) {}
362 A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
363 A2 operator[] (boost::arg<2>) const { return base_type::a2_; }
364 A3 operator[] (boost::arg<3>) const { return base_type::a3_; }
366 A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
367 A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; }
368 A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; }
370 template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
372 template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
374 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
376 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); }
378 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); }
380 template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
382 return unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]);
385 template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
387 return unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]);
390 template<class F, class A> void operator()(type<void>, F & f, A & a, int)
392 unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]);
395 template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
397 unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]);
400 template<class V> void accept(V & v) const
402 base_type::accept(v);
405 bool operator==(list3 const & rhs) const
409 ref_compare( base_type::a1_, rhs.a1_, 0 ) &&
410 ref_compare( base_type::a2_, rhs.a2_, 0 ) &&
411 ref_compare( base_type::a3_, rhs.a3_, 0 );
415 template< class A1, class A2, class A3, class A4 > class list4: private storage4< A1, A2, A3, A4 >
419 typedef storage4< A1, A2, A3, A4 > base_type;
423 list4( A1 a1, A2 a2, A3 a3, A4 a4 ): base_type( a1, a2, a3, a4 ) {}
425 A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
426 A2 operator[] (boost::arg<2>) const { return base_type::a2_; }
427 A3 operator[] (boost::arg<3>) const { return base_type::a3_; }
428 A4 operator[] (boost::arg<4>) const { return base_type::a4_; }
430 A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
431 A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; }
432 A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; }
433 A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; }
435 template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
437 template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
439 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
441 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); }
443 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); }
445 template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
447 return unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]);
450 template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
452 return unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]);
455 template<class F, class A> void operator()(type<void>, F & f, A & a, int)
457 unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]);
460 template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
462 unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]);
465 template<class V> void accept(V & v) const
467 base_type::accept(v);
470 bool operator==(list4 const & rhs) const
474 ref_compare( base_type::a1_, rhs.a1_, 0 ) &&
475 ref_compare( base_type::a2_, rhs.a2_, 0 ) &&
476 ref_compare( base_type::a3_, rhs.a3_, 0 ) &&
477 ref_compare( base_type::a4_, rhs.a4_, 0 );
481 template< class A1, class A2, class A3, class A4, class A5 > class list5: private storage5< A1, A2, A3, A4, A5 >
485 typedef storage5< A1, A2, A3, A4, A5 > base_type;
489 list5( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5 ): base_type( a1, a2, a3, a4, a5 ) {}
491 A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
492 A2 operator[] (boost::arg<2>) const { return base_type::a2_; }
493 A3 operator[] (boost::arg<3>) const { return base_type::a3_; }
494 A4 operator[] (boost::arg<4>) const { return base_type::a4_; }
495 A5 operator[] (boost::arg<5>) const { return base_type::a5_; }
497 A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
498 A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; }
499 A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; }
500 A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; }
501 A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; }
503 template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
505 template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
507 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
509 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); }
511 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); }
513 template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
515 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 template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
520 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 template<class F, class A> void operator()(type<void>, F & f, A & a, int)
525 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 template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
530 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 template<class V> void accept(V & v) const
535 base_type::accept(v);
538 bool operator==(list5 const & rhs) const
542 ref_compare( base_type::a1_, rhs.a1_, 0 ) &&
543 ref_compare( base_type::a2_, rhs.a2_, 0 ) &&
544 ref_compare( base_type::a3_, rhs.a3_, 0 ) &&
545 ref_compare( base_type::a4_, rhs.a4_, 0 ) &&
546 ref_compare( base_type::a5_, rhs.a5_, 0 );
550 template<class A1, class A2, class A3, class A4, class A5, class A6> class list6: private storage6< A1, A2, A3, A4, A5, A6 >
554 typedef storage6< A1, A2, A3, A4, A5, A6 > base_type;
558 list6( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6 ): base_type( a1, a2, a3, a4, a5, a6 ) {}
560 A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
561 A2 operator[] (boost::arg<2>) const { return base_type::a2_; }
562 A3 operator[] (boost::arg<3>) const { return base_type::a3_; }
563 A4 operator[] (boost::arg<4>) const { return base_type::a4_; }
564 A5 operator[] (boost::arg<5>) const { return base_type::a5_; }
565 A6 operator[] (boost::arg<6>) const { return base_type::a6_; }
567 A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
568 A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; }
569 A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; }
570 A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; }
571 A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; }
572 A6 operator[] (boost::arg<6> (*) ()) const { return base_type::a6_; }
574 template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
576 template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
578 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
580 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); }
582 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); }
584 template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
586 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 template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
591 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 template<class F, class A> void operator()(type<void>, F & f, A & a, int)
596 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 template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
601 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 template<class V> void accept(V & v) const
606 base_type::accept(v);
609 bool operator==(list6 const & rhs) const
613 ref_compare( base_type::a1_, rhs.a1_, 0 ) &&
614 ref_compare( base_type::a2_, rhs.a2_, 0 ) &&
615 ref_compare( base_type::a3_, rhs.a3_, 0 ) &&
616 ref_compare( base_type::a4_, rhs.a4_, 0 ) &&
617 ref_compare( base_type::a5_, rhs.a5_, 0 ) &&
618 ref_compare( base_type::a6_, rhs.a6_, 0 );
622 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 >
626 typedef storage7< A1, A2, A3, A4, A5, A6, A7 > base_type;
630 list7( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7 ): base_type( a1, a2, a3, a4, a5, a6, a7 ) {}
632 A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
633 A2 operator[] (boost::arg<2>) const { return base_type::a2_; }
634 A3 operator[] (boost::arg<3>) const { return base_type::a3_; }
635 A4 operator[] (boost::arg<4>) const { return base_type::a4_; }
636 A5 operator[] (boost::arg<5>) const { return base_type::a5_; }
637 A6 operator[] (boost::arg<6>) const { return base_type::a6_; }
638 A7 operator[] (boost::arg<7>) const { return base_type::a7_; }
640 A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
641 A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; }
642 A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; }
643 A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; }
644 A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; }
645 A6 operator[] (boost::arg<6> (*) ()) const { return base_type::a6_; }
646 A7 operator[] (boost::arg<7> (*) ()) const { return base_type::a7_; }
648 template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
650 template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
652 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
654 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); }
656 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); }
658 template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
660 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 template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
665 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 template<class F, class A> void operator()(type<void>, F & f, A & a, int)
670 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 template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
675 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 template<class V> void accept(V & v) const
680 base_type::accept(v);
683 bool operator==(list7 const & rhs) const
687 ref_compare( base_type::a1_, rhs.a1_, 0 ) &&
688 ref_compare( base_type::a2_, rhs.a2_, 0 ) &&
689 ref_compare( base_type::a3_, rhs.a3_, 0 ) &&
690 ref_compare( base_type::a4_, rhs.a4_, 0 ) &&
691 ref_compare( base_type::a5_, rhs.a5_, 0 ) &&
692 ref_compare( base_type::a6_, rhs.a6_, 0 ) &&
693 ref_compare( base_type::a7_, rhs.a7_, 0 );
697 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 >
701 typedef storage8< A1, A2, A3, A4, A5, A6, A7, A8 > base_type;
705 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 ) {}
707 A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
708 A2 operator[] (boost::arg<2>) const { return base_type::a2_; }
709 A3 operator[] (boost::arg<3>) const { return base_type::a3_; }
710 A4 operator[] (boost::arg<4>) const { return base_type::a4_; }
711 A5 operator[] (boost::arg<5>) const { return base_type::a5_; }
712 A6 operator[] (boost::arg<6>) const { return base_type::a6_; }
713 A7 operator[] (boost::arg<7>) const { return base_type::a7_; }
714 A8 operator[] (boost::arg<8>) const { return base_type::a8_; }
716 A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
717 A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; }
718 A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; }
719 A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; }
720 A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; }
721 A6 operator[] (boost::arg<6> (*) ()) const { return base_type::a6_; }
722 A7 operator[] (boost::arg<7> (*) ()) const { return base_type::a7_; }
723 A8 operator[] (boost::arg<8> (*) ()) const { return base_type::a8_; }
725 template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
727 template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
729 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
731 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); }
733 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); }
735 template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
737 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 template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
742 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 template<class F, class A> void operator()(type<void>, F & f, A & a, int)
747 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 template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
752 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 template<class V> void accept(V & v) const
757 base_type::accept(v);
760 bool operator==(list8 const & rhs) const
764 ref_compare( base_type::a1_, rhs.a1_, 0 ) &&
765 ref_compare( base_type::a2_, rhs.a2_, 0 ) &&
766 ref_compare( base_type::a3_, rhs.a3_, 0 ) &&
767 ref_compare( base_type::a4_, rhs.a4_, 0 ) &&
768 ref_compare( base_type::a5_, rhs.a5_, 0 ) &&
769 ref_compare( base_type::a6_, rhs.a6_, 0 ) &&
770 ref_compare( base_type::a7_, rhs.a7_, 0 ) &&
771 ref_compare( base_type::a8_, rhs.a8_, 0 );
775 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 >
779 typedef storage9< A1, A2, A3, A4, A5, A6, A7, A8, A9 > base_type;
783 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 ) {}
785 A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
786 A2 operator[] (boost::arg<2>) const { return base_type::a2_; }
787 A3 operator[] (boost::arg<3>) const { return base_type::a3_; }
788 A4 operator[] (boost::arg<4>) const { return base_type::a4_; }
789 A5 operator[] (boost::arg<5>) const { return base_type::a5_; }
790 A6 operator[] (boost::arg<6>) const { return base_type::a6_; }
791 A7 operator[] (boost::arg<7>) const { return base_type::a7_; }
792 A8 operator[] (boost::arg<8>) const { return base_type::a8_; }
793 A9 operator[] (boost::arg<9>) const { return base_type::a9_; }
795 A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
796 A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; }
797 A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; }
798 A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; }
799 A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; }
800 A6 operator[] (boost::arg<6> (*) ()) const { return base_type::a6_; }
801 A7 operator[] (boost::arg<7> (*) ()) const { return base_type::a7_; }
802 A8 operator[] (boost::arg<8> (*) ()) const { return base_type::a8_; }
803 A9 operator[] (boost::arg<9> (*) ()) const { return base_type::a9_; }
805 template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
807 template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
809 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
811 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); }
813 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); }
815 template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
817 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 template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
822 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 template<class F, class A> void operator()(type<void>, F & f, A & a, int)
827 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 template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
832 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 template<class V> void accept(V & v) const
837 base_type::accept(v);
840 bool operator==(list9 const & rhs) const
844 ref_compare( base_type::a1_, rhs.a1_, 0 ) &&
845 ref_compare( base_type::a2_, rhs.a2_, 0 ) &&
846 ref_compare( base_type::a3_, rhs.a3_, 0 ) &&
847 ref_compare( base_type::a4_, rhs.a4_, 0 ) &&
848 ref_compare( base_type::a5_, rhs.a5_, 0 ) &&
849 ref_compare( base_type::a6_, rhs.a6_, 0 ) &&
850 ref_compare( base_type::a7_, rhs.a7_, 0 ) &&
851 ref_compare( base_type::a8_, rhs.a8_, 0 ) &&
852 ref_compare( base_type::a9_, rhs.a9_, 0 );
862 #ifndef BOOST_NO_VOID_RETURNS
864 template<class R, class F, class L> class bind_t
868 typedef bind_t this_type;
870 bind_t(F f, L const & l): f_(f), l_(l) {}
872 #define BOOST_BIND_RETURN return
873 #include <boost/bind/bind_template.hpp>
874 #undef BOOST_BIND_RETURN
880 template<class R> struct bind_t_generator
883 template<class F, class L> class implementation
887 typedef implementation this_type;
889 implementation(F f, L const & l): f_(f), l_(l) {}
891 #define BOOST_BIND_RETURN return
892 #include <boost/bind/bind_template.hpp>
893 #undef BOOST_BIND_RETURN
899 template<> struct bind_t_generator<void>
902 template<class F, class L> class implementation
910 typedef implementation this_type;
912 implementation(F f, L const & l): f_(f), l_(l) {}
914 #define BOOST_BIND_RETURN
915 #include <boost/bind/bind_template.hpp>
916 #undef BOOST_BIND_RETURN
922 template<class R2, class F, class L> class bind_t: public bind_t_generator<R2>::BOOST_NESTED_TEMPLATE implementation<F, L>
926 bind_t(F f, L const & l): bind_t_generator<R2>::BOOST_NESTED_TEMPLATE implementation<F, L>(f, l) {}
934 #ifndef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
936 // put overloads in _bi, rely on ADL
938 # ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
940 template<class R, class F, class L> bool function_equal( bind_t<R, F, L> const & a, bind_t<R, F, L> const & b )
947 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 )
952 # endif // #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
954 #else // BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
956 // put overloads in boost
960 # ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
962 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 )
969 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 )
974 # endif // #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
979 #endif // BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
983 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) || (__SUNPRO_CC >= 0x530)
985 #if defined( __BORLANDC__ ) && BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0x582) )
987 template<class T> struct add_value
989 typedef _bi::value<T> type;
994 template< class T, int I > struct add_value_2
996 typedef boost::arg<I> type;
999 template< class T > struct add_value_2< T, 0 >
1001 typedef _bi::value< T > type;
1004 template<class T> struct add_value
1006 typedef typename add_value_2< T, boost::is_placeholder< T >::value >::type type;
1011 template<class T> struct add_value< value<T> >
1013 typedef _bi::value<T> type;
1016 template<class T> struct add_value< reference_wrapper<T> >
1018 typedef reference_wrapper<T> type;
1021 template<int I> struct add_value< arg<I> >
1023 typedef boost::arg<I> type;
1026 template<int I> struct add_value< arg<I> (*) () >
1028 typedef boost::arg<I> (*type) ();
1031 template<class R, class F, class L> struct add_value< bind_t<R, F, L> >
1033 typedef bind_t<R, F, L> type;
1038 template<int I> struct _avt_0;
1040 template<> struct _avt_0<1>
1042 template<class T> struct inner
1048 template<> struct _avt_0<2>
1050 template<class T> struct inner
1052 typedef value<T> type;
1056 typedef char (&_avt_r1) [1];
1057 typedef char (&_avt_r2) [2];
1059 template<class T> _avt_r1 _avt_f(value<T>);
1060 template<class T> _avt_r1 _avt_f(reference_wrapper<T>);
1061 template<int I> _avt_r1 _avt_f(arg<I>);
1062 template<int I> _avt_r1 _avt_f(arg<I> (*) ());
1063 template<class R, class F, class L> _avt_r1 _avt_f(bind_t<R, F, L>);
1065 _avt_r2 _avt_f(...);
1067 template<class T> struct add_value
1070 typedef typename _avt_0<sizeof(_avt_f(t()))>::template inner<T>::type type;
1077 template<class A1> struct list_av_1
1079 typedef typename add_value<A1>::type B1;
1080 typedef list1<B1> type;
1083 template<class A1, class A2> struct list_av_2
1085 typedef typename add_value<A1>::type B1;
1086 typedef typename add_value<A2>::type B2;
1087 typedef list2<B1, B2> type;
1090 template<class A1, class A2, class A3> struct list_av_3
1092 typedef typename add_value<A1>::type B1;
1093 typedef typename add_value<A2>::type B2;
1094 typedef typename add_value<A3>::type B3;
1095 typedef list3<B1, B2, B3> type;
1098 template<class A1, class A2, class A3, class A4> struct list_av_4
1100 typedef typename add_value<A1>::type B1;
1101 typedef typename add_value<A2>::type B2;
1102 typedef typename add_value<A3>::type B3;
1103 typedef typename add_value<A4>::type B4;
1104 typedef list4<B1, B2, B3, B4> type;
1107 template<class A1, class A2, class A3, class A4, class A5> struct list_av_5
1109 typedef typename add_value<A1>::type B1;
1110 typedef typename add_value<A2>::type B2;
1111 typedef typename add_value<A3>::type B3;
1112 typedef typename add_value<A4>::type B4;
1113 typedef typename add_value<A5>::type B5;
1114 typedef list5<B1, B2, B3, B4, B5> type;
1117 template<class A1, class A2, class A3, class A4, class A5, class A6> struct list_av_6
1119 typedef typename add_value<A1>::type B1;
1120 typedef typename add_value<A2>::type B2;
1121 typedef typename add_value<A3>::type B3;
1122 typedef typename add_value<A4>::type B4;
1123 typedef typename add_value<A5>::type B5;
1124 typedef typename add_value<A6>::type B6;
1125 typedef list6<B1, B2, B3, B4, B5, B6> type;
1128 template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> struct list_av_7
1130 typedef typename add_value<A1>::type B1;
1131 typedef typename add_value<A2>::type B2;
1132 typedef typename add_value<A3>::type B3;
1133 typedef typename add_value<A4>::type B4;
1134 typedef typename add_value<A5>::type B5;
1135 typedef typename add_value<A6>::type B6;
1136 typedef typename add_value<A7>::type B7;
1137 typedef list7<B1, B2, B3, B4, B5, B6, B7> type;
1140 template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> struct list_av_8
1142 typedef typename add_value<A1>::type B1;
1143 typedef typename add_value<A2>::type B2;
1144 typedef typename add_value<A3>::type B3;
1145 typedef typename add_value<A4>::type B4;
1146 typedef typename add_value<A5>::type B5;
1147 typedef typename add_value<A6>::type B6;
1148 typedef typename add_value<A7>::type B7;
1149 typedef typename add_value<A8>::type B8;
1150 typedef list8<B1, B2, B3, B4, B5, B6, B7, B8> type;
1153 template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> struct list_av_9
1155 typedef typename add_value<A1>::type B1;
1156 typedef typename add_value<A2>::type B2;
1157 typedef typename add_value<A3>::type B3;
1158 typedef typename add_value<A4>::type B4;
1159 typedef typename add_value<A5>::type B5;
1160 typedef typename add_value<A6>::type B6;
1161 typedef typename add_value<A7>::type B7;
1162 typedef typename add_value<A8>::type B8;
1163 typedef typename add_value<A9>::type B9;
1164 typedef list9<B1, B2, B3, B4, B5, B6, B7, B8, B9> type;
1171 template<class V> bool operator()(V const & v) const { return !v; }
1174 template<class R, class F, class L>
1175 bind_t< bool, logical_not, list1< bind_t<R, F, L> > >
1176 operator! (bind_t<R, F, L> const & f)
1178 typedef list1< bind_t<R, F, L> > list_type;
1179 return bind_t<bool, logical_not, list_type> ( logical_not(), list_type(f) );
1182 // relational operators
1184 #define BOOST_BIND_OPERATOR( op, name ) \
1188 template<class V, class W> bool operator()(V const & v, W const & w) const { return v op w; } \
1191 template<class R, class F, class L, class A2> \
1192 bind_t< bool, name, list2< bind_t<R, F, L>, typename add_value<A2>::type > > \
1193 operator op (bind_t<R, F, L> const & f, A2 a2) \
1195 typedef typename add_value<A2>::type B2; \
1196 typedef list2< bind_t<R, F, L>, B2> list_type; \
1197 return bind_t<bool, name, list_type> ( name(), list_type(f, a2) ); \
1200 BOOST_BIND_OPERATOR( ==, equal )
1201 BOOST_BIND_OPERATOR( !=, not_equal )
1203 BOOST_BIND_OPERATOR( <, less )
1204 BOOST_BIND_OPERATOR( <=, less_equal )
1206 BOOST_BIND_OPERATOR( >, greater )
1207 BOOST_BIND_OPERATOR( >=, greater_equal )
1209 BOOST_BIND_OPERATOR( &&, logical_and )
1210 BOOST_BIND_OPERATOR( ||, logical_or )
1212 #undef BOOST_BIND_OPERATOR
1214 #if defined(__GNUC__) && BOOST_WORKAROUND(__GNUC__, < 3)
1216 // resolve ambiguity with rel_ops
1218 #define BOOST_BIND_OPERATOR( op, name ) \
1220 template<class R, class F, class L> \
1221 bind_t< bool, name, list2< bind_t<R, F, L>, bind_t<R, F, L> > > \
1222 operator op (bind_t<R, F, L> const & f, bind_t<R, F, L> const & g) \
1224 typedef list2< bind_t<R, F, L>, bind_t<R, F, L> > list_type; \
1225 return bind_t<bool, name, list_type> ( name(), list_type(f, g) ); \
1228 BOOST_BIND_OPERATOR( !=, not_equal )
1229 BOOST_BIND_OPERATOR( <=, less_equal )
1230 BOOST_BIND_OPERATOR( >, greater )
1231 BOOST_BIND_OPERATOR( >=, greater_equal )
1237 #if !defined( BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP ) && !defined( __BORLANDC__ ) \
1238 && !(defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ <= 3)
1240 template<class V, class T> void visit_each( V & v, value<T> const & t, int )
1242 using boost::visit_each;
1243 BOOST_BIND_VISIT_EACH( v, t.get(), 0 );
1246 template<class V, class R, class F, class L> void visit_each( V & v, bind_t<R, F, L> const & t, int )
1255 // visit_each, no ADL
1257 #if defined( BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP ) || defined( __BORLANDC__ ) \
1258 || (defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ <= 3)
1260 template<class V, class T> void visit_each( V & v, _bi::value<T> const & t, int )
1262 BOOST_BIND_VISIT_EACH( v, t.get(), 0 );
1265 template<class V, class R, class F, class L> void visit_each( V & v, _bi::bind_t<R, F, L> const & t, int )
1272 // is_bind_expression
1274 template< class T > struct is_bind_expression
1276 enum _vt { value = 0 };
1279 #if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
1281 template< class R, class F, class L > struct is_bind_expression< _bi::bind_t< R, F, L > >
1283 enum _vt { value = 1 };
1291 #define BOOST_BIND bind
1294 // generic function objects
1296 template<class R, class F>
1297 _bi::bind_t<R, F, _bi::list0>
1300 typedef _bi::list0 list_type;
1301 return _bi::bind_t<R, F, list_type> (f, list_type());
1304 template<class R, class F, class A1>
1305 _bi::bind_t<R, F, typename _bi::list_av_1<A1>::type>
1306 BOOST_BIND(F f, A1 a1)
1308 typedef typename _bi::list_av_1<A1>::type list_type;
1309 return _bi::bind_t<R, F, list_type> (f, list_type(a1));
1312 template<class R, class F, class A1, class A2>
1313 _bi::bind_t<R, F, typename _bi::list_av_2<A1, A2>::type>
1314 BOOST_BIND(F f, A1 a1, A2 a2)
1316 typedef typename _bi::list_av_2<A1, A2>::type list_type;
1317 return _bi::bind_t<R, F, list_type> (f, list_type(a1, a2));
1320 template<class R, class F, class A1, class A2, class A3>
1321 _bi::bind_t<R, F, typename _bi::list_av_3<A1, A2, A3>::type>
1322 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3)
1324 typedef typename _bi::list_av_3<A1, A2, A3>::type list_type;
1325 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3));
1328 template<class R, class F, class A1, class A2, class A3, class A4>
1329 _bi::bind_t<R, F, typename _bi::list_av_4<A1, A2, A3, A4>::type>
1330 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4)
1332 typedef typename _bi::list_av_4<A1, A2, A3, A4>::type list_type;
1333 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4));
1336 template<class R, class F, class A1, class A2, class A3, class A4, class A5>
1337 _bi::bind_t<R, F, typename _bi::list_av_5<A1, A2, A3, A4, A5>::type>
1338 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5)
1340 typedef typename _bi::list_av_5<A1, A2, A3, A4, A5>::type list_type;
1341 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5));
1344 template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6>
1345 _bi::bind_t<R, F, typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type>
1346 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6)
1348 typedef typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type list_type;
1349 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6));
1352 template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7>
1353 _bi::bind_t<R, F, typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type>
1354 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7)
1356 typedef typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type list_type;
1357 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7));
1360 template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
1361 _bi::bind_t<R, F, typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type>
1362 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8)
1364 typedef typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type list_type;
1365 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8));
1368 template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9>
1369 _bi::bind_t<R, F, typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type>
1370 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9)
1372 typedef typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type list_type;
1373 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9));
1376 // generic function objects, alternative syntax
1378 template<class R, class F>
1379 _bi::bind_t<R, F, _bi::list0>
1380 BOOST_BIND(boost::type<R>, F f)
1382 typedef _bi::list0 list_type;
1383 return _bi::bind_t<R, F, list_type> (f, list_type());
1386 template<class R, class F, class A1>
1387 _bi::bind_t<R, F, typename _bi::list_av_1<A1>::type>
1388 BOOST_BIND(boost::type<R>, F f, A1 a1)
1390 typedef typename _bi::list_av_1<A1>::type list_type;
1391 return _bi::bind_t<R, F, list_type> (f, list_type(a1));
1394 template<class R, class F, class A1, class A2>
1395 _bi::bind_t<R, F, typename _bi::list_av_2<A1, A2>::type>
1396 BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2)
1398 typedef typename _bi::list_av_2<A1, A2>::type list_type;
1399 return _bi::bind_t<R, F, list_type> (f, list_type(a1, a2));
1402 template<class R, class F, class A1, class A2, class A3>
1403 _bi::bind_t<R, F, typename _bi::list_av_3<A1, A2, A3>::type>
1404 BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3)
1406 typedef typename _bi::list_av_3<A1, A2, A3>::type list_type;
1407 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3));
1410 template<class R, class F, class A1, class A2, class A3, class A4>
1411 _bi::bind_t<R, F, typename _bi::list_av_4<A1, A2, A3, A4>::type>
1412 BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3, A4 a4)
1414 typedef typename _bi::list_av_4<A1, A2, A3, A4>::type list_type;
1415 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4));
1418 template<class R, class F, class A1, class A2, class A3, class A4, class A5>
1419 _bi::bind_t<R, F, typename _bi::list_av_5<A1, A2, A3, A4, A5>::type>
1420 BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5)
1422 typedef typename _bi::list_av_5<A1, A2, A3, A4, A5>::type list_type;
1423 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5));
1426 template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6>
1427 _bi::bind_t<R, F, typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type>
1428 BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6)
1430 typedef typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type list_type;
1431 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6));
1434 template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7>
1435 _bi::bind_t<R, F, typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type>
1436 BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7)
1438 typedef typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type list_type;
1439 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7));
1442 template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
1443 _bi::bind_t<R, F, typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type>
1444 BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8)
1446 typedef typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type list_type;
1447 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8));
1450 template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9>
1451 _bi::bind_t<R, F, typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type>
1452 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)
1454 typedef typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type list_type;
1455 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9));
1458 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
1460 // adaptable function objects
1463 _bi::bind_t<_bi::unspecified, F, _bi::list0>
1466 typedef _bi::list0 list_type;
1467 return _bi::bind_t<_bi::unspecified, F, list_type> (f, list_type());
1470 template<class F, class A1>
1471 _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_1<A1>::type>
1472 BOOST_BIND(F f, A1 a1)
1474 typedef typename _bi::list_av_1<A1>::type list_type;
1475 return _bi::bind_t<_bi::unspecified, F, list_type> (f, list_type(a1));
1478 template<class F, class A1, class A2>
1479 _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_2<A1, A2>::type>
1480 BOOST_BIND(F f, A1 a1, A2 a2)
1482 typedef typename _bi::list_av_2<A1, A2>::type list_type;
1483 return _bi::bind_t<_bi::unspecified, F, list_type> (f, list_type(a1, a2));
1486 template<class F, class A1, class A2, class A3>
1487 _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_3<A1, A2, A3>::type>
1488 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3)
1490 typedef typename _bi::list_av_3<A1, A2, A3>::type list_type;
1491 return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3));
1494 template<class F, class A1, class A2, class A3, class A4>
1495 _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_4<A1, A2, A3, A4>::type>
1496 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4)
1498 typedef typename _bi::list_av_4<A1, A2, A3, A4>::type list_type;
1499 return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4));
1502 template<class F, class A1, class A2, class A3, class A4, class A5>
1503 _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_5<A1, A2, A3, A4, A5>::type>
1504 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5)
1506 typedef typename _bi::list_av_5<A1, A2, A3, A4, A5>::type list_type;
1507 return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5));
1510 template<class F, class A1, class A2, class A3, class A4, class A5, class A6>
1511 _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type>
1512 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6)
1514 typedef typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type list_type;
1515 return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6));
1518 template<class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7>
1519 _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type>
1520 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7)
1522 typedef typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type list_type;
1523 return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7));
1526 template<class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
1527 _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type>
1528 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8)
1530 typedef typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type list_type;
1531 return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8));
1534 template<class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9>
1535 _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type>
1536 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9)
1538 typedef typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type list_type;
1539 return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9));
1542 #endif // !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
1544 // function pointers
1546 #define BOOST_BIND_CC
1547 #define BOOST_BIND_ST
1549 #include <boost/bind/bind_cc.hpp>
1551 #undef BOOST_BIND_CC
1552 #undef BOOST_BIND_ST
1554 #ifdef BOOST_BIND_ENABLE_STDCALL
1556 #define BOOST_BIND_CC __stdcall
1557 #define BOOST_BIND_ST
1559 #include <boost/bind/bind_cc.hpp>
1561 #undef BOOST_BIND_CC
1562 #undef BOOST_BIND_ST
1566 #ifdef BOOST_BIND_ENABLE_FASTCALL
1568 #define BOOST_BIND_CC __fastcall
1569 #define BOOST_BIND_ST
1571 #include <boost/bind/bind_cc.hpp>
1573 #undef BOOST_BIND_CC
1574 #undef BOOST_BIND_ST
1578 #ifdef BOOST_BIND_ENABLE_PASCAL
1580 #define BOOST_BIND_ST pascal
1581 #define BOOST_BIND_CC
1583 #include <boost/bind/bind_cc.hpp>
1585 #undef BOOST_BIND_ST
1586 #undef BOOST_BIND_CC
1590 // member function pointers
1592 #define BOOST_BIND_MF_NAME(X) X
1593 #define BOOST_BIND_MF_CC
1595 #include <boost/bind/bind_mf_cc.hpp>
1596 #include <boost/bind/bind_mf2_cc.hpp>
1598 #undef BOOST_BIND_MF_NAME
1599 #undef BOOST_BIND_MF_CC
1601 #ifdef BOOST_MEM_FN_ENABLE_CDECL
1603 #define BOOST_BIND_MF_NAME(X) X##_cdecl
1604 #define BOOST_BIND_MF_CC __cdecl
1606 #include <boost/bind/bind_mf_cc.hpp>
1607 #include <boost/bind/bind_mf2_cc.hpp>
1609 #undef BOOST_BIND_MF_NAME
1610 #undef BOOST_BIND_MF_CC
1614 #ifdef BOOST_MEM_FN_ENABLE_STDCALL
1616 #define BOOST_BIND_MF_NAME(X) X##_stdcall
1617 #define BOOST_BIND_MF_CC __stdcall
1619 #include <boost/bind/bind_mf_cc.hpp>
1620 #include <boost/bind/bind_mf2_cc.hpp>
1622 #undef BOOST_BIND_MF_NAME
1623 #undef BOOST_BIND_MF_CC
1627 #ifdef BOOST_MEM_FN_ENABLE_FASTCALL
1629 #define BOOST_BIND_MF_NAME(X) X##_fastcall
1630 #define BOOST_BIND_MF_CC __fastcall
1632 #include <boost/bind/bind_mf_cc.hpp>
1633 #include <boost/bind/bind_mf2_cc.hpp>
1635 #undef BOOST_BIND_MF_NAME
1636 #undef BOOST_BIND_MF_CC
1640 // data member pointers
1642 #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) || defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \
1643 || ( defined(__BORLANDC__) && BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT( 0x620 ) ) )
1645 template<class R, class T, class A1>
1646 _bi::bind_t< R, _mfi::dm<R, T>, typename _bi::list_av_1<A1>::type >
1647 BOOST_BIND(R T::*f, A1 a1)
1649 typedef _mfi::dm<R, T> F;
1650 typedef typename _bi::list_av_1<A1>::type list_type;
1651 return _bi::bind_t<R, F, list_type>( F(f), list_type(a1) );
1659 template< class Pm, int I > struct add_cref;
1661 template< class M, class T > struct add_cref< M T::*, 0 >
1666 template< class M, class T > struct add_cref< M T::*, 1 >
1669 #pragma warning(push)
1670 #pragma warning(disable:4180)
1672 typedef M const & type;
1674 #pragma warning(pop)
1678 template< class R, class T > struct add_cref< R (T::*) (), 1 >
1683 #if !( defined(__IBMCPP__) && BOOST_WORKAROUND( __IBMCPP__, BOOST_TESTED_AT(600) ) )
1685 template< class R, class T > struct add_cref< R (T::*) () const, 1 >
1690 #endif // __IBMCPP__
1692 template<class R> struct isref
1694 enum value_type { value = 0 };
1697 template<class R> struct isref< R& >
1699 enum value_type { value = 1 };
1702 template<class R> struct isref< R* >
1704 enum value_type { value = 1 };
1707 template<class Pm, class A1> struct dm_result
1709 typedef typename add_cref< Pm, 1 >::type type;
1712 template<class Pm, class R, class F, class L> struct dm_result< Pm, bind_t<R, F, L> >
1714 typedef typename bind_t<R, F, L>::result_type result_type;
1715 typedef typename add_cref< Pm, isref< result_type >::value >::type type;
1720 template< class A1, class M, class T >
1723 typename _bi::dm_result< M T::*, A1 >::type,
1725 typename _bi::list_av_1<A1>::type
1728 BOOST_BIND( M T::*f, A1 a1 )
1730 typedef typename _bi::dm_result< M T::*, A1 >::type result_type;
1731 typedef _mfi::dm<M, T> F;
1732 typedef typename _bi::list_av_1<A1>::type list_type;
1733 return _bi::bind_t< result_type, F, list_type >( F( f ), list_type( a1 ) );
1738 } // namespace boost
1740 #ifndef BOOST_BIND_NO_PLACEHOLDERS
1742 # include <boost/bind/placeholders.hpp>
1747 # pragma warning(default: 4512) // assignment operator could not be generated
1748 # pragma warning(pop)
1751 #endif // #ifndef BOOST_BIND_BIND_HPP_INCLUDED