1 #ifndef BOOST_BIND_HPP_INCLUDED
2 #define BOOST_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/bind/arg.hpp>
29 #include <boost/detail/workaround.hpp>
30 #include <boost/visit_each.hpp>
32 // Borland-specific bug, visit_each() silently fails to produce code
34 #if defined(__BORLANDC__)
35 # define BOOST_BIND_VISIT_EACH boost::visit_each
37 # define BOOST_BIND_VISIT_EACH visit_each
40 #include <boost/bind/storage.hpp>
43 # pragma warning(push)
44 # pragma warning(disable: 4512) // assignment operator could not be generated
50 namespace _bi // implementation details
55 template<class R, class F> struct result_traits
60 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
62 struct unspecified {};
64 template<class F> struct result_traits<unspecified, F>
66 typedef typename F::result_type type;
69 template<class F> struct result_traits< unspecified, reference_wrapper<F> >
71 typedef typename F::result_type type;
78 template<class T> bool ref_compare( T const & a, T const & b, long )
83 template<int I> bool ref_compare( arg<I> const &, arg<I> const &, int )
88 template<int I> bool ref_compare( arg<I> (*) (), arg<I> (*) (), int )
93 template<class T> bool ref_compare( reference_wrapper<T> const & a, reference_wrapper<T> const & b, int )
95 return a.get_pointer() == b.get_pointer();
98 // bind_t forward declaration for listN
100 template<class R, class F, class L> class bind_t;
104 template<class T> class value
108 value(T const & t): t_(t) {}
110 T & get() { return t_; }
111 T const & get() const { return t_; }
113 bool operator==(value const & rhs) const
125 template<class T> class type {};
129 template<class F> struct unwrapper
131 static inline F & unwrap( F & f, long )
136 template<class F2> static inline F2 & unwrap( reference_wrapper<F2> rf, int )
141 template<class R, class T> static inline _mfi::dm<R, T> unwrap( R T::* pm, int )
143 return _mfi::dm<R, T>( pm );
155 template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
157 template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
159 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
161 template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const { return b.eval(*this); }
163 template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); }
165 template<class R, class F, class A> R operator()(type<R>, F & f, A &, long)
167 return unwrapper<F>::unwrap(f, 0)();
170 template<class R, class F, class A> R operator()(type<R>, F const & f, A &, long) const
172 return unwrapper<F const>::unwrap(f, 0)();
175 template<class F, class A> void operator()(type<void>, F & f, A &, int)
177 unwrapper<F>::unwrap(f, 0)();
180 template<class F, class A> void operator()(type<void>, F const & f, A &, int) const
182 unwrapper<F const>::unwrap(f, 0)();
185 template<class V> void accept(V &) const
189 bool operator==(list0 const &) const
195 template< class A1 > class list1: private storage1< A1 >
199 typedef storage1< A1 > base_type;
203 explicit list1( A1 a1 ): base_type( a1 ) {}
205 A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
207 A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
209 template<class T> T & operator[] ( _bi::value<T> & v ) const { return v.get(); }
211 template<class T> T const & operator[] ( _bi::value<T> const & v ) const { return v.get(); }
213 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
215 template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const { return b.eval(*this); }
217 template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); }
219 template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
221 return unwrapper<F>::unwrap(f, 0)(a[base_type::a1_]);
224 template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
226 return unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_]);
229 template<class F, class A> void operator()(type<void>, F & f, A & a, int)
231 unwrapper<F>::unwrap(f, 0)(a[base_type::a1_]);
234 template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
236 unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_]);
239 template<class V> void accept(V & v) const
241 base_type::accept(v);
244 bool operator==(list1 const & rhs) const
246 return ref_compare(base_type::a1_, rhs.a1_, 0);
250 template< class A1, class A2 > class list2: private storage2< A1, A2 >
254 typedef storage2< A1, A2 > base_type;
258 list2( A1 a1, A2 a2 ): base_type( a1, a2 ) {}
260 A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
261 A2 operator[] (boost::arg<2>) const { return base_type::a2_; }
263 A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
264 A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; }
266 template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
268 template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
270 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
272 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); }
274 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); }
276 template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
278 return unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]);
281 template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
283 return unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]);
286 template<class F, class A> void operator()(type<void>, F & f, A & a, int)
288 unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]);
291 template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
293 unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]);
296 template<class V> void accept(V & v) const
298 base_type::accept(v);
301 bool operator==(list2 const & rhs) const
303 return ref_compare(base_type::a1_, rhs.a1_, 0) && ref_compare(base_type::a2_, rhs.a2_, 0);
307 template< class A1, class A2, class A3 > class list3: private storage3< A1, A2, A3 >
311 typedef storage3< A1, A2, A3 > base_type;
315 list3( A1 a1, A2 a2, A3 a3 ): base_type( a1, a2, a3 ) {}
317 A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
318 A2 operator[] (boost::arg<2>) const { return base_type::a2_; }
319 A3 operator[] (boost::arg<3>) const { return base_type::a3_; }
321 A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
322 A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; }
323 A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; }
325 template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
327 template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
329 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
331 template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const { return b.eval(*this); }
333 template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); }
335 template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
337 return unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]);
340 template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
342 return unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]);
345 template<class F, class A> void operator()(type<void>, F & f, A & a, int)
347 unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]);
350 template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
352 unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]);
355 template<class V> void accept(V & v) const
357 base_type::accept(v);
360 bool operator==(list3 const & rhs) const
364 ref_compare( base_type::a1_, rhs.a1_, 0 ) &&
365 ref_compare( base_type::a2_, rhs.a2_, 0 ) &&
366 ref_compare( base_type::a3_, rhs.a3_, 0 );
370 template< class A1, class A2, class A3, class A4 > class list4: private storage4< A1, A2, A3, A4 >
374 typedef storage4< A1, A2, A3, A4 > base_type;
378 list4( A1 a1, A2 a2, A3 a3, A4 a4 ): base_type( a1, a2, a3, a4 ) {}
380 A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
381 A2 operator[] (boost::arg<2>) const { return base_type::a2_; }
382 A3 operator[] (boost::arg<3>) const { return base_type::a3_; }
383 A4 operator[] (boost::arg<4>) const { return base_type::a4_; }
385 A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
386 A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; }
387 A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; }
388 A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; }
390 template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
392 template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
394 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
396 template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const { return b.eval(*this); }
398 template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); }
400 template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
402 return unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]);
405 template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
407 return unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]);
410 template<class F, class A> void operator()(type<void>, F & f, A & a, int)
412 unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]);
415 template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
417 unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]);
420 template<class V> void accept(V & v) const
422 base_type::accept(v);
425 bool operator==(list4 const & rhs) const
429 ref_compare( base_type::a1_, rhs.a1_, 0 ) &&
430 ref_compare( base_type::a2_, rhs.a2_, 0 ) &&
431 ref_compare( base_type::a3_, rhs.a3_, 0 ) &&
432 ref_compare( base_type::a4_, rhs.a4_, 0 );
436 template< class A1, class A2, class A3, class A4, class A5 > class list5: private storage5< A1, A2, A3, A4, A5 >
440 typedef storage5< A1, A2, A3, A4, A5 > base_type;
444 list5( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5 ): base_type( a1, a2, a3, a4, a5 ) {}
446 A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
447 A2 operator[] (boost::arg<2>) const { return base_type::a2_; }
448 A3 operator[] (boost::arg<3>) const { return base_type::a3_; }
449 A4 operator[] (boost::arg<4>) const { return base_type::a4_; }
450 A5 operator[] (boost::arg<5>) const { return base_type::a5_; }
452 A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
453 A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; }
454 A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; }
455 A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; }
456 A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; }
458 template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
460 template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
462 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
464 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); }
466 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); }
468 template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
470 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_]);
473 template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
475 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_]);
478 template<class F, class A> void operator()(type<void>, F & f, A & a, int)
480 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_]);
483 template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
485 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_]);
488 template<class V> void accept(V & v) const
490 base_type::accept(v);
493 bool operator==(list5 const & rhs) const
497 ref_compare( base_type::a1_, rhs.a1_, 0 ) &&
498 ref_compare( base_type::a2_, rhs.a2_, 0 ) &&
499 ref_compare( base_type::a3_, rhs.a3_, 0 ) &&
500 ref_compare( base_type::a4_, rhs.a4_, 0 ) &&
501 ref_compare( base_type::a5_, rhs.a5_, 0 );
505 template<class A1, class A2, class A3, class A4, class A5, class A6> class list6: private storage6< A1, A2, A3, A4, A5, A6 >
509 typedef storage6< A1, A2, A3, A4, A5, A6 > base_type;
513 list6( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6 ): base_type( a1, a2, a3, a4, a5, a6 ) {}
515 A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
516 A2 operator[] (boost::arg<2>) const { return base_type::a2_; }
517 A3 operator[] (boost::arg<3>) const { return base_type::a3_; }
518 A4 operator[] (boost::arg<4>) const { return base_type::a4_; }
519 A5 operator[] (boost::arg<5>) const { return base_type::a5_; }
520 A6 operator[] (boost::arg<6>) const { return base_type::a6_; }
522 A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
523 A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; }
524 A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; }
525 A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; }
526 A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; }
527 A6 operator[] (boost::arg<6> (*) ()) const { return base_type::a6_; }
529 template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
531 template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
533 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
535 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); }
537 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); }
539 template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
541 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_]);
544 template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
546 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_]);
549 template<class F, class A> void operator()(type<void>, F & f, A & a, int)
551 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_]);
554 template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
556 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_]);
559 template<class V> void accept(V & v) const
561 base_type::accept(v);
564 bool operator==(list6 const & rhs) const
568 ref_compare( base_type::a1_, rhs.a1_, 0 ) &&
569 ref_compare( base_type::a2_, rhs.a2_, 0 ) &&
570 ref_compare( base_type::a3_, rhs.a3_, 0 ) &&
571 ref_compare( base_type::a4_, rhs.a4_, 0 ) &&
572 ref_compare( base_type::a5_, rhs.a5_, 0 ) &&
573 ref_compare( base_type::a6_, rhs.a6_, 0 );
577 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 >
581 typedef storage7< A1, A2, A3, A4, A5, A6, A7 > base_type;
585 list7( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7 ): base_type( a1, a2, a3, a4, a5, a6, a7 ) {}
587 A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
588 A2 operator[] (boost::arg<2>) const { return base_type::a2_; }
589 A3 operator[] (boost::arg<3>) const { return base_type::a3_; }
590 A4 operator[] (boost::arg<4>) const { return base_type::a4_; }
591 A5 operator[] (boost::arg<5>) const { return base_type::a5_; }
592 A6 operator[] (boost::arg<6>) const { return base_type::a6_; }
593 A7 operator[] (boost::arg<7>) const { return base_type::a7_; }
595 A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
596 A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; }
597 A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; }
598 A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; }
599 A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; }
600 A6 operator[] (boost::arg<6> (*) ()) const { return base_type::a6_; }
601 A7 operator[] (boost::arg<7> (*) ()) const { return base_type::a7_; }
603 template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
605 template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
607 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
609 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); }
611 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); }
613 template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
615 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_]);
618 template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
620 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_]);
623 template<class F, class A> void operator()(type<void>, F & f, A & a, int)
625 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_]);
628 template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
630 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_]);
633 template<class V> void accept(V & v) const
635 base_type::accept(v);
638 bool operator==(list7 const & rhs) const
642 ref_compare( base_type::a1_, rhs.a1_, 0 ) &&
643 ref_compare( base_type::a2_, rhs.a2_, 0 ) &&
644 ref_compare( base_type::a3_, rhs.a3_, 0 ) &&
645 ref_compare( base_type::a4_, rhs.a4_, 0 ) &&
646 ref_compare( base_type::a5_, rhs.a5_, 0 ) &&
647 ref_compare( base_type::a6_, rhs.a6_, 0 ) &&
648 ref_compare( base_type::a7_, rhs.a7_, 0 );
652 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 >
656 typedef storage8< A1, A2, A3, A4, A5, A6, A7, A8 > base_type;
660 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 ) {}
662 A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
663 A2 operator[] (boost::arg<2>) const { return base_type::a2_; }
664 A3 operator[] (boost::arg<3>) const { return base_type::a3_; }
665 A4 operator[] (boost::arg<4>) const { return base_type::a4_; }
666 A5 operator[] (boost::arg<5>) const { return base_type::a5_; }
667 A6 operator[] (boost::arg<6>) const { return base_type::a6_; }
668 A7 operator[] (boost::arg<7>) const { return base_type::a7_; }
669 A8 operator[] (boost::arg<8>) const { return base_type::a8_; }
671 A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
672 A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; }
673 A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; }
674 A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; }
675 A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; }
676 A6 operator[] (boost::arg<6> (*) ()) const { return base_type::a6_; }
677 A7 operator[] (boost::arg<7> (*) ()) const { return base_type::a7_; }
678 A8 operator[] (boost::arg<8> (*) ()) const { return base_type::a8_; }
680 template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
682 template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
684 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
686 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); }
688 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); }
690 template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
692 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_]);
695 template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
697 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_]);
700 template<class F, class A> void operator()(type<void>, F & f, A & a, int)
702 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_]);
705 template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
707 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_]);
710 template<class V> void accept(V & v) const
712 base_type::accept(v);
715 bool operator==(list8 const & rhs) const
719 ref_compare( base_type::a1_, rhs.a1_, 0 ) &&
720 ref_compare( base_type::a2_, rhs.a2_, 0 ) &&
721 ref_compare( base_type::a3_, rhs.a3_, 0 ) &&
722 ref_compare( base_type::a4_, rhs.a4_, 0 ) &&
723 ref_compare( base_type::a5_, rhs.a5_, 0 ) &&
724 ref_compare( base_type::a6_, rhs.a6_, 0 ) &&
725 ref_compare( base_type::a7_, rhs.a7_, 0 ) &&
726 ref_compare( base_type::a8_, rhs.a8_, 0 );
730 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 >
734 typedef storage9< A1, A2, A3, A4, A5, A6, A7, A8, A9 > base_type;
738 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 ) {}
740 A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
741 A2 operator[] (boost::arg<2>) const { return base_type::a2_; }
742 A3 operator[] (boost::arg<3>) const { return base_type::a3_; }
743 A4 operator[] (boost::arg<4>) const { return base_type::a4_; }
744 A5 operator[] (boost::arg<5>) const { return base_type::a5_; }
745 A6 operator[] (boost::arg<6>) const { return base_type::a6_; }
746 A7 operator[] (boost::arg<7>) const { return base_type::a7_; }
747 A8 operator[] (boost::arg<8>) const { return base_type::a8_; }
748 A9 operator[] (boost::arg<9>) const { return base_type::a9_; }
750 A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
751 A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; }
752 A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; }
753 A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; }
754 A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; }
755 A6 operator[] (boost::arg<6> (*) ()) const { return base_type::a6_; }
756 A7 operator[] (boost::arg<7> (*) ()) const { return base_type::a7_; }
757 A8 operator[] (boost::arg<8> (*) ()) const { return base_type::a8_; }
758 A9 operator[] (boost::arg<9> (*) ()) const { return base_type::a9_; }
760 template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
762 template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
764 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
766 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); }
768 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); }
770 template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
772 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_]);
775 template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
777 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_]);
780 template<class F, class A> void operator()(type<void>, F & f, A & a, int)
782 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_]);
785 template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
787 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_]);
790 template<class V> void accept(V & v) const
792 base_type::accept(v);
795 bool operator==(list9 const & rhs) const
799 ref_compare( base_type::a1_, rhs.a1_, 0 ) &&
800 ref_compare( base_type::a2_, rhs.a2_, 0 ) &&
801 ref_compare( base_type::a3_, rhs.a3_, 0 ) &&
802 ref_compare( base_type::a4_, rhs.a4_, 0 ) &&
803 ref_compare( base_type::a5_, rhs.a5_, 0 ) &&
804 ref_compare( base_type::a6_, rhs.a6_, 0 ) &&
805 ref_compare( base_type::a7_, rhs.a7_, 0 ) &&
806 ref_compare( base_type::a8_, rhs.a8_, 0 ) &&
807 ref_compare( base_type::a9_, rhs.a9_, 0 );
813 #ifndef BOOST_NO_VOID_RETURNS
815 template<class R, class F, class L> class bind_t
819 typedef bind_t this_type;
821 bind_t(F f, L const & l): f_(f), l_(l) {}
823 #define BOOST_BIND_RETURN return
824 #include <boost/bind/bind_template.hpp>
825 #undef BOOST_BIND_RETURN
831 template<class R> struct bind_t_generator
834 template<class F, class L> class implementation
838 typedef implementation this_type;
840 implementation(F f, L const & l): f_(f), l_(l) {}
842 #define BOOST_BIND_RETURN return
843 #include <boost/bind/bind_template.hpp>
844 #undef BOOST_BIND_RETURN
850 template<> struct bind_t_generator<void>
853 template<class F, class L> class implementation
861 typedef implementation this_type;
863 implementation(F f, L const & l): f_(f), l_(l) {}
865 #define BOOST_BIND_RETURN
866 #include <boost/bind/bind_template.hpp>
867 #undef BOOST_BIND_RETURN
873 template<class R2, class F, class L> class bind_t: public bind_t_generator<R2>::BOOST_NESTED_TEMPLATE implementation<F, L>
877 bind_t(F f, L const & l): bind_t_generator<R2>::BOOST_NESTED_TEMPLATE implementation<F, L>(f, l) {}
885 #ifndef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
887 // put overloads in _bi, rely on ADL
889 # ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
891 template<class R, class F, class L> bool function_equal( bind_t<R, F, L> const & a, bind_t<R, F, L> const & b )
898 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 )
903 # endif // #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
905 #else // BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
907 // put overloads in boost
911 # ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
913 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 )
920 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 )
925 # endif // #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
930 #endif // BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
934 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) || (__SUNPRO_CC >= 0x530)
936 template<class T> struct add_value
938 typedef _bi::value<T> type;
941 template<class T> struct add_value< value<T> >
943 typedef _bi::value<T> type;
946 template<class T> struct add_value< reference_wrapper<T> >
948 typedef reference_wrapper<T> type;
951 template<int I> struct add_value< arg<I> >
953 typedef boost::arg<I> type;
956 template<int I> struct add_value< arg<I> (*) () >
958 typedef boost::arg<I> (*type) ();
961 template<class R, class F, class L> struct add_value< bind_t<R, F, L> >
963 typedef bind_t<R, F, L> type;
968 template<int I> struct _avt_0;
970 template<> struct _avt_0<1>
972 template<class T> struct inner
978 template<> struct _avt_0<2>
980 template<class T> struct inner
982 typedef value<T> type;
986 typedef char (&_avt_r1) [1];
987 typedef char (&_avt_r2) [2];
989 template<class T> _avt_r1 _avt_f(value<T>);
990 template<class T> _avt_r1 _avt_f(reference_wrapper<T>);
991 template<int I> _avt_r1 _avt_f(arg<I>);
992 template<int I> _avt_r1 _avt_f(arg<I> (*) ());
993 template<class R, class F, class L> _avt_r1 _avt_f(bind_t<R, F, L>);
997 template<class T> struct add_value
1000 typedef typename _avt_0<sizeof(_avt_f(t()))>::template inner<T>::type type;
1007 template<class A1> struct list_av_1
1009 typedef typename add_value<A1>::type B1;
1010 typedef list1<B1> type;
1013 template<class A1, class A2> struct list_av_2
1015 typedef typename add_value<A1>::type B1;
1016 typedef typename add_value<A2>::type B2;
1017 typedef list2<B1, B2> type;
1020 template<class A1, class A2, class A3> struct list_av_3
1022 typedef typename add_value<A1>::type B1;
1023 typedef typename add_value<A2>::type B2;
1024 typedef typename add_value<A3>::type B3;
1025 typedef list3<B1, B2, B3> type;
1028 template<class A1, class A2, class A3, class A4> struct list_av_4
1030 typedef typename add_value<A1>::type B1;
1031 typedef typename add_value<A2>::type B2;
1032 typedef typename add_value<A3>::type B3;
1033 typedef typename add_value<A4>::type B4;
1034 typedef list4<B1, B2, B3, B4> type;
1037 template<class A1, class A2, class A3, class A4, class A5> struct list_av_5
1039 typedef typename add_value<A1>::type B1;
1040 typedef typename add_value<A2>::type B2;
1041 typedef typename add_value<A3>::type B3;
1042 typedef typename add_value<A4>::type B4;
1043 typedef typename add_value<A5>::type B5;
1044 typedef list5<B1, B2, B3, B4, B5> type;
1047 template<class A1, class A2, class A3, class A4, class A5, class A6> struct list_av_6
1049 typedef typename add_value<A1>::type B1;
1050 typedef typename add_value<A2>::type B2;
1051 typedef typename add_value<A3>::type B3;
1052 typedef typename add_value<A4>::type B4;
1053 typedef typename add_value<A5>::type B5;
1054 typedef typename add_value<A6>::type B6;
1055 typedef list6<B1, B2, B3, B4, B5, B6> type;
1058 template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> struct list_av_7
1060 typedef typename add_value<A1>::type B1;
1061 typedef typename add_value<A2>::type B2;
1062 typedef typename add_value<A3>::type B3;
1063 typedef typename add_value<A4>::type B4;
1064 typedef typename add_value<A5>::type B5;
1065 typedef typename add_value<A6>::type B6;
1066 typedef typename add_value<A7>::type B7;
1067 typedef list7<B1, B2, B3, B4, B5, B6, B7> type;
1070 template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> struct list_av_8
1072 typedef typename add_value<A1>::type B1;
1073 typedef typename add_value<A2>::type B2;
1074 typedef typename add_value<A3>::type B3;
1075 typedef typename add_value<A4>::type B4;
1076 typedef typename add_value<A5>::type B5;
1077 typedef typename add_value<A6>::type B6;
1078 typedef typename add_value<A7>::type B7;
1079 typedef typename add_value<A8>::type B8;
1080 typedef list8<B1, B2, B3, B4, B5, B6, B7, B8> type;
1083 template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> struct list_av_9
1085 typedef typename add_value<A1>::type B1;
1086 typedef typename add_value<A2>::type B2;
1087 typedef typename add_value<A3>::type B3;
1088 typedef typename add_value<A4>::type B4;
1089 typedef typename add_value<A5>::type B5;
1090 typedef typename add_value<A6>::type B6;
1091 typedef typename add_value<A7>::type B7;
1092 typedef typename add_value<A8>::type B8;
1093 typedef typename add_value<A9>::type B9;
1094 typedef list9<B1, B2, B3, B4, B5, B6, B7, B8, B9> type;
1101 template<class V> bool operator()(V const & v) const { return !v; }
1104 template<class R, class F, class L>
1105 bind_t< bool, logical_not, list1< bind_t<R, F, L> > >
1106 operator! (bind_t<R, F, L> const & f)
1108 typedef list1< bind_t<R, F, L> > list_type;
1109 return bind_t<bool, logical_not, list_type> ( logical_not(), list_type(f) );
1112 // relational operators
1114 #define BOOST_BIND_OPERATOR( op, name ) \
1118 template<class V, class W> bool operator()(V const & v, W const & w) const { return v op w; } \
1121 template<class R, class F, class L, class A2> \
1122 bind_t< bool, name, list2< bind_t<R, F, L>, typename add_value<A2>::type > > \
1123 operator op (bind_t<R, F, L> const & f, A2 a2) \
1125 typedef typename add_value<A2>::type B2; \
1126 typedef list2< bind_t<R, F, L>, B2> list_type; \
1127 return bind_t<bool, name, list_type> ( name(), list_type(f, a2) ); \
1130 BOOST_BIND_OPERATOR( ==, equal )
1131 BOOST_BIND_OPERATOR( !=, not_equal )
1133 BOOST_BIND_OPERATOR( <, less )
1134 BOOST_BIND_OPERATOR( <=, less_equal )
1136 BOOST_BIND_OPERATOR( >, greater )
1137 BOOST_BIND_OPERATOR( >=, greater_equal )
1139 #undef BOOST_BIND_OPERATOR
1141 #if defined(__GNUC__) && BOOST_WORKAROUND(__GNUC__, < 3)
1143 // resolve ambiguity with rel_ops
1145 #define BOOST_BIND_OPERATOR( op, name ) \
1147 template<class R, class F, class L> \
1148 bind_t< bool, name, list2< bind_t<R, F, L>, bind_t<R, F, L> > > \
1149 operator op (bind_t<R, F, L> const & f, bind_t<R, F, L> const & g) \
1151 typedef list2< bind_t<R, F, L>, bind_t<R, F, L> > list_type; \
1152 return bind_t<bool, name, list_type> ( name(), list_type(f, g) ); \
1155 BOOST_BIND_OPERATOR( !=, not_equal )
1156 BOOST_BIND_OPERATOR( <=, less_equal )
1157 BOOST_BIND_OPERATOR( >, greater )
1158 BOOST_BIND_OPERATOR( >=, greater_equal )
1164 #if !defined( BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP ) && !defined( __BORLANDC__ )
1166 template<class V, class T> void visit_each( V & v, value<T> const & t, int )
1168 using boost::visit_each;
1169 BOOST_BIND_VISIT_EACH( v, t.get(), 0 );
1172 template<class V, class R, class F, class L> void visit_each( V & v, bind_t<R, F, L> const & t, int )
1181 // visit_each, no ADL
1183 #if defined( BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP ) || defined( __BORLANDC__ )
1185 template<class V, class T> void visit_each( V & v, _bi::value<T> const & t, int )
1187 BOOST_BIND_VISIT_EACH( v, t.get(), 0 );
1190 template<class V, class R, class F, class L> void visit_each( V & v, _bi::bind_t<R, F, L> const & t, int )
1200 #define BOOST_BIND bind
1203 // generic function objects
1205 template<class R, class F>
1206 _bi::bind_t<R, F, _bi::list0>
1209 typedef _bi::list0 list_type;
1210 return _bi::bind_t<R, F, list_type> (f, list_type());
1213 template<class R, class F, class A1>
1214 _bi::bind_t<R, F, typename _bi::list_av_1<A1>::type>
1215 BOOST_BIND(F f, A1 a1)
1217 typedef typename _bi::list_av_1<A1>::type list_type;
1218 return _bi::bind_t<R, F, list_type> (f, list_type(a1));
1221 template<class R, class F, class A1, class A2>
1222 _bi::bind_t<R, F, typename _bi::list_av_2<A1, A2>::type>
1223 BOOST_BIND(F f, A1 a1, A2 a2)
1225 typedef typename _bi::list_av_2<A1, A2>::type list_type;
1226 return _bi::bind_t<R, F, list_type> (f, list_type(a1, a2));
1229 template<class R, class F, class A1, class A2, class A3>
1230 _bi::bind_t<R, F, typename _bi::list_av_3<A1, A2, A3>::type>
1231 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3)
1233 typedef typename _bi::list_av_3<A1, A2, A3>::type list_type;
1234 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3));
1237 template<class R, class F, class A1, class A2, class A3, class A4>
1238 _bi::bind_t<R, F, typename _bi::list_av_4<A1, A2, A3, A4>::type>
1239 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4)
1241 typedef typename _bi::list_av_4<A1, A2, A3, A4>::type list_type;
1242 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4));
1245 template<class R, class F, class A1, class A2, class A3, class A4, class A5>
1246 _bi::bind_t<R, F, typename _bi::list_av_5<A1, A2, A3, A4, A5>::type>
1247 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5)
1249 typedef typename _bi::list_av_5<A1, A2, A3, A4, A5>::type list_type;
1250 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5));
1253 template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6>
1254 _bi::bind_t<R, F, typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type>
1255 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6)
1257 typedef typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type list_type;
1258 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6));
1261 template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7>
1262 _bi::bind_t<R, F, typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type>
1263 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7)
1265 typedef typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type list_type;
1266 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7));
1269 template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
1270 _bi::bind_t<R, F, typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type>
1271 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8)
1273 typedef typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type list_type;
1274 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8));
1277 template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9>
1278 _bi::bind_t<R, F, typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type>
1279 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9)
1281 typedef typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type list_type;
1282 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9));
1285 // generic function objects, alternative syntax
1287 template<class R, class F>
1288 _bi::bind_t<R, F, _bi::list0>
1289 BOOST_BIND(boost::type<R>, F f)
1291 typedef _bi::list0 list_type;
1292 return _bi::bind_t<R, F, list_type> (f, list_type());
1295 template<class R, class F, class A1>
1296 _bi::bind_t<R, F, typename _bi::list_av_1<A1>::type>
1297 BOOST_BIND(boost::type<R>, F f, A1 a1)
1299 typedef typename _bi::list_av_1<A1>::type list_type;
1300 return _bi::bind_t<R, F, list_type> (f, list_type(a1));
1303 template<class R, class F, class A1, class A2>
1304 _bi::bind_t<R, F, typename _bi::list_av_2<A1, A2>::type>
1305 BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2)
1307 typedef typename _bi::list_av_2<A1, A2>::type list_type;
1308 return _bi::bind_t<R, F, list_type> (f, list_type(a1, a2));
1311 template<class R, class F, class A1, class A2, class A3>
1312 _bi::bind_t<R, F, typename _bi::list_av_3<A1, A2, A3>::type>
1313 BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3)
1315 typedef typename _bi::list_av_3<A1, A2, A3>::type list_type;
1316 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3));
1319 template<class R, class F, class A1, class A2, class A3, class A4>
1320 _bi::bind_t<R, F, typename _bi::list_av_4<A1, A2, A3, A4>::type>
1321 BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3, A4 a4)
1323 typedef typename _bi::list_av_4<A1, A2, A3, A4>::type list_type;
1324 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4));
1327 template<class R, class F, class A1, class A2, class A3, class A4, class A5>
1328 _bi::bind_t<R, F, typename _bi::list_av_5<A1, A2, A3, A4, A5>::type>
1329 BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5)
1331 typedef typename _bi::list_av_5<A1, A2, A3, A4, A5>::type list_type;
1332 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5));
1335 template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6>
1336 _bi::bind_t<R, F, typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type>
1337 BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6)
1339 typedef typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type list_type;
1340 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6));
1343 template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7>
1344 _bi::bind_t<R, F, typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type>
1345 BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7)
1347 typedef typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type list_type;
1348 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7));
1351 template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
1352 _bi::bind_t<R, F, typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type>
1353 BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8)
1355 typedef typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type list_type;
1356 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8));
1359 template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9>
1360 _bi::bind_t<R, F, typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type>
1361 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)
1363 typedef typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type list_type;
1364 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9));
1367 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
1369 // adaptable function objects
1372 _bi::bind_t<_bi::unspecified, F, _bi::list0>
1375 typedef _bi::list0 list_type;
1376 return _bi::bind_t<_bi::unspecified, F, list_type> (f, list_type());
1379 template<class F, class A1>
1380 _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_1<A1>::type>
1381 BOOST_BIND(F f, A1 a1)
1383 typedef typename _bi::list_av_1<A1>::type list_type;
1384 return _bi::bind_t<_bi::unspecified, F, list_type> (f, list_type(a1));
1387 template<class F, class A1, class A2>
1388 _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_2<A1, A2>::type>
1389 BOOST_BIND(F f, A1 a1, A2 a2)
1391 typedef typename _bi::list_av_2<A1, A2>::type list_type;
1392 return _bi::bind_t<_bi::unspecified, F, list_type> (f, list_type(a1, a2));
1395 template<class F, class A1, class A2, class A3>
1396 _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_3<A1, A2, A3>::type>
1397 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3)
1399 typedef typename _bi::list_av_3<A1, A2, A3>::type list_type;
1400 return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3));
1403 template<class F, class A1, class A2, class A3, class A4>
1404 _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_4<A1, A2, A3, A4>::type>
1405 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4)
1407 typedef typename _bi::list_av_4<A1, A2, A3, A4>::type list_type;
1408 return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4));
1411 template<class F, class A1, class A2, class A3, class A4, class A5>
1412 _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_5<A1, A2, A3, A4, A5>::type>
1413 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5)
1415 typedef typename _bi::list_av_5<A1, A2, A3, A4, A5>::type list_type;
1416 return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5));
1419 template<class F, class A1, class A2, class A3, class A4, class A5, class A6>
1420 _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type>
1421 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6)
1423 typedef typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type list_type;
1424 return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6));
1427 template<class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7>
1428 _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type>
1429 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7)
1431 typedef typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type list_type;
1432 return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7));
1435 template<class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
1436 _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type>
1437 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8)
1439 typedef typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type list_type;
1440 return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8));
1443 template<class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9>
1444 _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type>
1445 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9)
1447 typedef typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type list_type;
1448 return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9));
1451 #endif // !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
1453 // function pointers
1455 #define BOOST_BIND_CC
1456 #define BOOST_BIND_ST
1458 #include <boost/bind/bind_cc.hpp>
1460 #undef BOOST_BIND_CC
1461 #undef BOOST_BIND_ST
1463 #ifdef BOOST_BIND_ENABLE_STDCALL
1465 #define BOOST_BIND_CC __stdcall
1466 #define BOOST_BIND_ST
1468 #include <boost/bind/bind_cc.hpp>
1470 #undef BOOST_BIND_CC
1471 #undef BOOST_BIND_ST
1475 #ifdef BOOST_BIND_ENABLE_FASTCALL
1477 #define BOOST_BIND_CC __fastcall
1478 #define BOOST_BIND_ST
1480 #include <boost/bind/bind_cc.hpp>
1482 #undef BOOST_BIND_CC
1483 #undef BOOST_BIND_ST
1487 #ifdef BOOST_BIND_ENABLE_PASCAL
1489 #define BOOST_BIND_ST pascal
1490 #define BOOST_BIND_CC
1492 #include <boost/bind/bind_cc.hpp>
1494 #undef BOOST_BIND_ST
1495 #undef BOOST_BIND_CC
1499 // member function pointers
1501 #define BOOST_BIND_MF_NAME(X) X
1502 #define BOOST_BIND_MF_CC
1504 #include <boost/bind/bind_mf_cc.hpp>
1506 #undef BOOST_BIND_MF_NAME
1507 #undef BOOST_BIND_MF_CC
1509 #ifdef BOOST_MEM_FN_ENABLE_CDECL
1511 #define BOOST_BIND_MF_NAME(X) X##_cdecl
1512 #define BOOST_BIND_MF_CC __cdecl
1514 #include <boost/bind/bind_mf_cc.hpp>
1516 #undef BOOST_BIND_MF_NAME
1517 #undef BOOST_BIND_MF_CC
1521 #ifdef BOOST_MEM_FN_ENABLE_STDCALL
1523 #define BOOST_BIND_MF_NAME(X) X##_stdcall
1524 #define BOOST_BIND_MF_CC __stdcall
1526 #include <boost/bind/bind_mf_cc.hpp>
1528 #undef BOOST_BIND_MF_NAME
1529 #undef BOOST_BIND_MF_CC
1533 #ifdef BOOST_MEM_FN_ENABLE_FASTCALL
1535 #define BOOST_BIND_MF_NAME(X) X##_fastcall
1536 #define BOOST_BIND_MF_CC __fastcall
1538 #include <boost/bind/bind_mf_cc.hpp>
1540 #undef BOOST_BIND_MF_NAME
1541 #undef BOOST_BIND_MF_CC
1545 // data member pointers
1547 #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) || defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \
1548 || ( defined(__BORLANDC__) && BOOST_WORKAROUND( __BORLANDC__, < 0x600 ) )
1550 template<class R, class T, class A1>
1551 _bi::bind_t< R, _mfi::dm<R, T>, typename _bi::list_av_1<A1>::type >
1552 BOOST_BIND(R T::*f, A1 a1)
1554 typedef _mfi::dm<R, T> F;
1555 typedef typename _bi::list_av_1<A1>::type list_type;
1556 return _bi::bind_t<R, F, list_type>( F(f), list_type(a1) );
1564 template< class Pm, int I > struct add_cref;
1566 template< class M, class T > struct add_cref< M T::*, 0 >
1571 template< class M, class T > struct add_cref< M T::*, 1 >
1573 typedef M const & type;
1576 template< class R, class T > struct add_cref< R (T::*) (), 1 >
1581 #if !( defined(__IBMCPP__) && BOOST_WORKAROUND( __IBMCPP__, BOOST_TESTED_AT(600) ) )
1583 template< class R, class T > struct add_cref< R (T::*) () const, 1 >
1588 #endif // __IBMCPP__
1590 template<class R> struct isref
1592 enum value_type { value = 0 };
1595 template<class R> struct isref< R& >
1597 enum value_type { value = 1 };
1600 template<class R> struct isref< R* >
1602 enum value_type { value = 1 };
1605 template<class Pm, class A1> struct dm_result
1607 typedef typename add_cref< Pm, 1 >::type type;
1610 template<class Pm, class R, class F, class L> struct dm_result< Pm, bind_t<R, F, L> >
1612 typedef typename bind_t<R, F, L>::result_type result_type;
1613 typedef typename add_cref< Pm, isref< result_type >::value >::type type;
1618 template< class A1, class M, class T >
1621 typename _bi::dm_result< M T::*, A1 >::type,
1623 typename _bi::list_av_1<A1>::type
1626 BOOST_BIND( M T::*f, A1 a1 )
1628 typedef typename _bi::dm_result< M T::*, A1 >::type result_type;
1629 typedef _mfi::dm<M, T> F;
1630 typedef typename _bi::list_av_1<A1>::type list_type;
1631 return _bi::bind_t< result_type, F, list_type >( F( f ), list_type( a1 ) );
1636 } // namespace boost
1638 #ifndef BOOST_BIND_NO_PLACEHOLDERS
1640 # include <boost/bind/placeholders.hpp>
1645 # pragma warning(default: 4512) // assignment operator could not be generated
1646 # pragma warning(pop)
1649 #endif // #ifndef BOOST_BIND_HPP_INCLUDED