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/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 namespace _bi // implementation details
56 template<class R, class F> struct result_traits
61 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
63 struct unspecified {};
65 template<class F> struct result_traits<unspecified, F>
67 typedef typename F::result_type type;
70 template<class F> struct result_traits< unspecified, reference_wrapper<F> >
72 typedef typename F::result_type type;
79 template<class T> bool ref_compare( T const & a, T const & b, long )
84 template<int I> bool ref_compare( arg<I> const &, arg<I> const &, int )
89 template<int I> bool ref_compare( arg<I> (*) (), arg<I> (*) (), int )
94 template<class T> bool ref_compare( reference_wrapper<T> const & a, reference_wrapper<T> const & b, int )
96 return a.get_pointer() == b.get_pointer();
99 // bind_t forward declaration for listN
101 template<class R, class F, class L> class bind_t;
105 template<class T> class value
109 value(T const & t): t_(t) {}
111 T & get() { return t_; }
112 T const & get() const { return t_; }
114 bool operator==(value const & rhs) const
126 template<class T> class type {};
130 template<class F> struct unwrapper
132 static inline F & unwrap( F & f, long )
137 template<class F2> static inline F2 & unwrap( reference_wrapper<F2> rf, int )
142 template<class R, class T> static inline _mfi::dm<R, T> unwrap( R T::* pm, int )
144 return _mfi::dm<R, T>( pm );
156 template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
158 template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
160 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
162 template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> & b) const { return b.eval(*this); }
164 template<class R, class F, class L> typename result_traits<R, F>::type operator[] (bind_t<R, F, L> const & b) const { return b.eval(*this); }
166 template<class R, class F, class A> R operator()(type<R>, F & f, A &, long)
168 return unwrapper<F>::unwrap(f, 0)();
171 template<class R, class F, class A> R operator()(type<R>, F const & f, A &, long) const
173 return unwrapper<F const>::unwrap(f, 0)();
176 template<class F, class A> void operator()(type<void>, F & f, A &, int)
178 unwrapper<F>::unwrap(f, 0)();
181 template<class F, class A> void operator()(type<void>, F const & f, A &, int) const
183 unwrapper<F const>::unwrap(f, 0)();
186 template<class V> void accept(V &) const
190 bool operator==(list0 const &) const
196 template< class A1 > class list1: private storage1< A1 >
200 typedef storage1< A1 > base_type;
204 explicit list1( A1 a1 ): base_type( a1 ) {}
206 A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
208 A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
210 template<class T> T & operator[] ( _bi::value<T> & v ) const { return v.get(); }
212 template<class T> T const & operator[] ( _bi::value<T> const & v ) const { return v.get(); }
214 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
216 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); }
218 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); }
220 template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
222 return unwrapper<F>::unwrap(f, 0)(a[base_type::a1_]);
225 template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
227 return unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_]);
230 template<class F, class A> void operator()(type<void>, F & f, A & a, int)
232 unwrapper<F>::unwrap(f, 0)(a[base_type::a1_]);
235 template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
237 unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_]);
240 template<class V> void accept(V & v) const
242 base_type::accept(v);
245 bool operator==(list1 const & rhs) const
247 return ref_compare(base_type::a1_, rhs.a1_, 0);
254 template< class A1, class A2 > class list2: private storage2< A1, A2 >
258 typedef storage2< A1, A2 > base_type;
262 list2( A1 a1, A2 a2 ): base_type( a1, a2 ) {}
264 A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
265 A2 operator[] (boost::arg<2>) const { return base_type::a2_; }
267 A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
268 A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; }
270 template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
272 template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
274 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
276 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); }
278 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); }
280 template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
282 return unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]);
285 template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
287 return unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]);
290 template<class F, class A> void operator()(type<void>, F & f, A & a, int)
292 unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]);
295 template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
297 unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]);
300 template<class A> bool operator()( type<bool>, logical_and & /*f*/, A & a, int )
302 return a[ base_type::a1_ ] && a[ base_type::a2_ ];
305 template<class A> bool operator()( type<bool>, logical_and const & /*f*/, A & a, int ) const
307 return a[ base_type::a1_ ] && a[ base_type::a2_ ];
310 template<class A> bool operator()( type<bool>, logical_or & /*f*/, A & a, int )
312 return a[ base_type::a1_ ] || a[ base_type::a2_ ];
315 template<class A> bool operator()( type<bool>, logical_or const & /*f*/, A & a, int ) const
317 return a[ base_type::a1_ ] || a[ base_type::a2_ ];
320 template<class V> void accept(V & v) const
322 base_type::accept(v);
325 bool operator==(list2 const & rhs) const
327 return ref_compare(base_type::a1_, rhs.a1_, 0) && ref_compare(base_type::a2_, rhs.a2_, 0);
331 template< class A1, class A2, class A3 > class list3: private storage3< A1, A2, A3 >
335 typedef storage3< A1, A2, A3 > base_type;
339 list3( A1 a1, A2 a2, A3 a3 ): base_type( a1, a2, a3 ) {}
341 A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
342 A2 operator[] (boost::arg<2>) const { return base_type::a2_; }
343 A3 operator[] (boost::arg<3>) const { return base_type::a3_; }
345 A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
346 A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; }
347 A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; }
349 template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
351 template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
353 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
355 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); }
357 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); }
359 template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
361 return unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]);
364 template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
366 return unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]);
369 template<class F, class A> void operator()(type<void>, F & f, A & a, int)
371 unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]);
374 template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
376 unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]);
379 template<class V> void accept(V & v) const
381 base_type::accept(v);
384 bool operator==(list3 const & rhs) const
388 ref_compare( base_type::a1_, rhs.a1_, 0 ) &&
389 ref_compare( base_type::a2_, rhs.a2_, 0 ) &&
390 ref_compare( base_type::a3_, rhs.a3_, 0 );
394 template< class A1, class A2, class A3, class A4 > class list4: private storage4< A1, A2, A3, A4 >
398 typedef storage4< A1, A2, A3, A4 > base_type;
402 list4( A1 a1, A2 a2, A3 a3, A4 a4 ): base_type( a1, a2, a3, a4 ) {}
404 A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
405 A2 operator[] (boost::arg<2>) const { return base_type::a2_; }
406 A3 operator[] (boost::arg<3>) const { return base_type::a3_; }
407 A4 operator[] (boost::arg<4>) const { return base_type::a4_; }
409 A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
410 A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; }
411 A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; }
412 A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; }
414 template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
416 template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
418 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
420 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); }
422 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); }
424 template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
426 return unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]);
429 template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
431 return unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]);
434 template<class F, class A> void operator()(type<void>, F & f, A & a, int)
436 unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]);
439 template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
441 unwrapper<F const>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]);
444 template<class V> void accept(V & v) const
446 base_type::accept(v);
449 bool operator==(list4 const & rhs) const
453 ref_compare( base_type::a1_, rhs.a1_, 0 ) &&
454 ref_compare( base_type::a2_, rhs.a2_, 0 ) &&
455 ref_compare( base_type::a3_, rhs.a3_, 0 ) &&
456 ref_compare( base_type::a4_, rhs.a4_, 0 );
460 template< class A1, class A2, class A3, class A4, class A5 > class list5: private storage5< A1, A2, A3, A4, A5 >
464 typedef storage5< A1, A2, A3, A4, A5 > base_type;
468 list5( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5 ): base_type( a1, a2, a3, a4, a5 ) {}
470 A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
471 A2 operator[] (boost::arg<2>) const { return base_type::a2_; }
472 A3 operator[] (boost::arg<3>) const { return base_type::a3_; }
473 A4 operator[] (boost::arg<4>) const { return base_type::a4_; }
474 A5 operator[] (boost::arg<5>) const { return base_type::a5_; }
476 A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
477 A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; }
478 A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; }
479 A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; }
480 A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; }
482 template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
484 template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
486 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
488 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); }
490 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); }
492 template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
494 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_]);
497 template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
499 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_]);
502 template<class F, class A> void operator()(type<void>, F & f, A & a, int)
504 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_]);
507 template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
509 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_]);
512 template<class V> void accept(V & v) const
514 base_type::accept(v);
517 bool operator==(list5 const & rhs) const
521 ref_compare( base_type::a1_, rhs.a1_, 0 ) &&
522 ref_compare( base_type::a2_, rhs.a2_, 0 ) &&
523 ref_compare( base_type::a3_, rhs.a3_, 0 ) &&
524 ref_compare( base_type::a4_, rhs.a4_, 0 ) &&
525 ref_compare( base_type::a5_, rhs.a5_, 0 );
529 template<class A1, class A2, class A3, class A4, class A5, class A6> class list6: private storage6< A1, A2, A3, A4, A5, A6 >
533 typedef storage6< A1, A2, A3, A4, A5, A6 > base_type;
537 list6( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6 ): base_type( a1, a2, a3, a4, a5, a6 ) {}
539 A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
540 A2 operator[] (boost::arg<2>) const { return base_type::a2_; }
541 A3 operator[] (boost::arg<3>) const { return base_type::a3_; }
542 A4 operator[] (boost::arg<4>) const { return base_type::a4_; }
543 A5 operator[] (boost::arg<5>) const { return base_type::a5_; }
544 A6 operator[] (boost::arg<6>) const { return base_type::a6_; }
546 A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
547 A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; }
548 A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; }
549 A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; }
550 A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; }
551 A6 operator[] (boost::arg<6> (*) ()) const { return base_type::a6_; }
553 template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
555 template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
557 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
559 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); }
561 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); }
563 template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
565 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_]);
568 template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
570 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_]);
573 template<class F, class A> void operator()(type<void>, F & f, A & a, int)
575 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_]);
578 template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
580 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_]);
583 template<class V> void accept(V & v) const
585 base_type::accept(v);
588 bool operator==(list6 const & rhs) const
592 ref_compare( base_type::a1_, rhs.a1_, 0 ) &&
593 ref_compare( base_type::a2_, rhs.a2_, 0 ) &&
594 ref_compare( base_type::a3_, rhs.a3_, 0 ) &&
595 ref_compare( base_type::a4_, rhs.a4_, 0 ) &&
596 ref_compare( base_type::a5_, rhs.a5_, 0 ) &&
597 ref_compare( base_type::a6_, rhs.a6_, 0 );
601 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 >
605 typedef storage7< A1, A2, A3, A4, A5, A6, A7 > base_type;
609 list7( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7 ): base_type( a1, a2, a3, a4, a5, a6, a7 ) {}
611 A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
612 A2 operator[] (boost::arg<2>) const { return base_type::a2_; }
613 A3 operator[] (boost::arg<3>) const { return base_type::a3_; }
614 A4 operator[] (boost::arg<4>) const { return base_type::a4_; }
615 A5 operator[] (boost::arg<5>) const { return base_type::a5_; }
616 A6 operator[] (boost::arg<6>) const { return base_type::a6_; }
617 A7 operator[] (boost::arg<7>) const { return base_type::a7_; }
619 A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
620 A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; }
621 A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; }
622 A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; }
623 A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; }
624 A6 operator[] (boost::arg<6> (*) ()) const { return base_type::a6_; }
625 A7 operator[] (boost::arg<7> (*) ()) const { return base_type::a7_; }
627 template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
629 template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
631 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
633 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); }
635 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); }
637 template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
639 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_]);
642 template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
644 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_]);
647 template<class F, class A> void operator()(type<void>, F & f, A & a, int)
649 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_]);
652 template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
654 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_]);
657 template<class V> void accept(V & v) const
659 base_type::accept(v);
662 bool operator==(list7 const & rhs) const
666 ref_compare( base_type::a1_, rhs.a1_, 0 ) &&
667 ref_compare( base_type::a2_, rhs.a2_, 0 ) &&
668 ref_compare( base_type::a3_, rhs.a3_, 0 ) &&
669 ref_compare( base_type::a4_, rhs.a4_, 0 ) &&
670 ref_compare( base_type::a5_, rhs.a5_, 0 ) &&
671 ref_compare( base_type::a6_, rhs.a6_, 0 ) &&
672 ref_compare( base_type::a7_, rhs.a7_, 0 );
676 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 >
680 typedef storage8< A1, A2, A3, A4, A5, A6, A7, A8 > base_type;
684 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 ) {}
686 A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
687 A2 operator[] (boost::arg<2>) const { return base_type::a2_; }
688 A3 operator[] (boost::arg<3>) const { return base_type::a3_; }
689 A4 operator[] (boost::arg<4>) const { return base_type::a4_; }
690 A5 operator[] (boost::arg<5>) const { return base_type::a5_; }
691 A6 operator[] (boost::arg<6>) const { return base_type::a6_; }
692 A7 operator[] (boost::arg<7>) const { return base_type::a7_; }
693 A8 operator[] (boost::arg<8>) const { return base_type::a8_; }
695 A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
696 A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; }
697 A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; }
698 A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; }
699 A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; }
700 A6 operator[] (boost::arg<6> (*) ()) const { return base_type::a6_; }
701 A7 operator[] (boost::arg<7> (*) ()) const { return base_type::a7_; }
702 A8 operator[] (boost::arg<8> (*) ()) const { return base_type::a8_; }
704 template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
706 template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
708 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
710 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); }
712 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); }
714 template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
716 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_]);
719 template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
721 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_]);
724 template<class F, class A> void operator()(type<void>, F & f, A & a, int)
726 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_]);
729 template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
731 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_]);
734 template<class V> void accept(V & v) const
736 base_type::accept(v);
739 bool operator==(list8 const & rhs) const
743 ref_compare( base_type::a1_, rhs.a1_, 0 ) &&
744 ref_compare( base_type::a2_, rhs.a2_, 0 ) &&
745 ref_compare( base_type::a3_, rhs.a3_, 0 ) &&
746 ref_compare( base_type::a4_, rhs.a4_, 0 ) &&
747 ref_compare( base_type::a5_, rhs.a5_, 0 ) &&
748 ref_compare( base_type::a6_, rhs.a6_, 0 ) &&
749 ref_compare( base_type::a7_, rhs.a7_, 0 ) &&
750 ref_compare( base_type::a8_, rhs.a8_, 0 );
754 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 >
758 typedef storage9< A1, A2, A3, A4, A5, A6, A7, A8, A9 > base_type;
762 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 ) {}
764 A1 operator[] (boost::arg<1>) const { return base_type::a1_; }
765 A2 operator[] (boost::arg<2>) const { return base_type::a2_; }
766 A3 operator[] (boost::arg<3>) const { return base_type::a3_; }
767 A4 operator[] (boost::arg<4>) const { return base_type::a4_; }
768 A5 operator[] (boost::arg<5>) const { return base_type::a5_; }
769 A6 operator[] (boost::arg<6>) const { return base_type::a6_; }
770 A7 operator[] (boost::arg<7>) const { return base_type::a7_; }
771 A8 operator[] (boost::arg<8>) const { return base_type::a8_; }
772 A9 operator[] (boost::arg<9>) const { return base_type::a9_; }
774 A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; }
775 A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; }
776 A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; }
777 A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; }
778 A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; }
779 A6 operator[] (boost::arg<6> (*) ()) const { return base_type::a6_; }
780 A7 operator[] (boost::arg<7> (*) ()) const { return base_type::a7_; }
781 A8 operator[] (boost::arg<8> (*) ()) const { return base_type::a8_; }
782 A9 operator[] (boost::arg<9> (*) ()) const { return base_type::a9_; }
784 template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
786 template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
788 template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
790 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); }
792 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); }
794 template<class R, class F, class A> R operator()(type<R>, F & f, A & a, long)
796 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_]);
799 template<class R, class F, class A> R operator()(type<R>, F const & f, A & a, long) const
801 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_]);
804 template<class F, class A> void operator()(type<void>, F & f, A & a, int)
806 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_]);
809 template<class F, class A> void operator()(type<void>, F const & f, A & a, int) const
811 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_]);
814 template<class V> void accept(V & v) const
816 base_type::accept(v);
819 bool operator==(list9 const & rhs) const
823 ref_compare( base_type::a1_, rhs.a1_, 0 ) &&
824 ref_compare( base_type::a2_, rhs.a2_, 0 ) &&
825 ref_compare( base_type::a3_, rhs.a3_, 0 ) &&
826 ref_compare( base_type::a4_, rhs.a4_, 0 ) &&
827 ref_compare( base_type::a5_, rhs.a5_, 0 ) &&
828 ref_compare( base_type::a6_, rhs.a6_, 0 ) &&
829 ref_compare( base_type::a7_, rhs.a7_, 0 ) &&
830 ref_compare( base_type::a8_, rhs.a8_, 0 ) &&
831 ref_compare( base_type::a9_, rhs.a9_, 0 );
837 #ifndef BOOST_NO_VOID_RETURNS
839 template<class R, class F, class L> class bind_t
843 typedef bind_t this_type;
845 bind_t(F f, L const & l): f_(f), l_(l) {}
847 #define BOOST_BIND_RETURN return
848 #include <boost/bind/bind_template.hpp>
849 #undef BOOST_BIND_RETURN
855 template<class R> struct bind_t_generator
858 template<class F, class L> class implementation
862 typedef implementation this_type;
864 implementation(F f, L const & l): f_(f), l_(l) {}
866 #define BOOST_BIND_RETURN return
867 #include <boost/bind/bind_template.hpp>
868 #undef BOOST_BIND_RETURN
874 template<> struct bind_t_generator<void>
877 template<class F, class L> class implementation
885 typedef implementation this_type;
887 implementation(F f, L const & l): f_(f), l_(l) {}
889 #define BOOST_BIND_RETURN
890 #include <boost/bind/bind_template.hpp>
891 #undef BOOST_BIND_RETURN
897 template<class R2, class F, class L> class bind_t: public bind_t_generator<R2>::BOOST_NESTED_TEMPLATE implementation<F, L>
901 bind_t(F f, L const & l): bind_t_generator<R2>::BOOST_NESTED_TEMPLATE implementation<F, L>(f, l) {}
909 #ifndef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
911 // put overloads in _bi, rely on ADL
913 # ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
915 template<class R, class F, class L> bool function_equal( bind_t<R, F, L> const & a, bind_t<R, F, L> const & b )
922 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 )
927 # endif // #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
929 #else // BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
931 // put overloads in boost
935 # ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
937 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 )
944 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 )
949 # endif // #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
954 #endif // BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
958 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) || (__SUNPRO_CC >= 0x530)
960 #if defined( __BORLANDC__ ) && BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0x582) )
962 template<class T> struct add_value
964 typedef _bi::value<T> type;
969 template< class T, int I > struct add_value_2
971 typedef boost::arg<I> type;
974 template< class T > struct add_value_2< T, 0 >
976 typedef _bi::value< T > type;
979 template<class T> struct add_value
981 typedef typename add_value_2< T, boost::is_placeholder< T >::value >::type type;
986 template<class T> struct add_value< value<T> >
988 typedef _bi::value<T> type;
991 template<class T> struct add_value< reference_wrapper<T> >
993 typedef reference_wrapper<T> type;
996 template<int I> struct add_value< arg<I> >
998 typedef boost::arg<I> type;
1001 template<int I> struct add_value< arg<I> (*) () >
1003 typedef boost::arg<I> (*type) ();
1006 template<class R, class F, class L> struct add_value< bind_t<R, F, L> >
1008 typedef bind_t<R, F, L> type;
1013 template<int I> struct _avt_0;
1015 template<> struct _avt_0<1>
1017 template<class T> struct inner
1023 template<> struct _avt_0<2>
1025 template<class T> struct inner
1027 typedef value<T> type;
1031 typedef char (&_avt_r1) [1];
1032 typedef char (&_avt_r2) [2];
1034 template<class T> _avt_r1 _avt_f(value<T>);
1035 template<class T> _avt_r1 _avt_f(reference_wrapper<T>);
1036 template<int I> _avt_r1 _avt_f(arg<I>);
1037 template<int I> _avt_r1 _avt_f(arg<I> (*) ());
1038 template<class R, class F, class L> _avt_r1 _avt_f(bind_t<R, F, L>);
1040 _avt_r2 _avt_f(...);
1042 template<class T> struct add_value
1045 typedef typename _avt_0<sizeof(_avt_f(t()))>::template inner<T>::type type;
1052 template<class A1> struct list_av_1
1054 typedef typename add_value<A1>::type B1;
1055 typedef list1<B1> type;
1058 template<class A1, class A2> struct list_av_2
1060 typedef typename add_value<A1>::type B1;
1061 typedef typename add_value<A2>::type B2;
1062 typedef list2<B1, B2> type;
1065 template<class A1, class A2, class A3> struct list_av_3
1067 typedef typename add_value<A1>::type B1;
1068 typedef typename add_value<A2>::type B2;
1069 typedef typename add_value<A3>::type B3;
1070 typedef list3<B1, B2, B3> type;
1073 template<class A1, class A2, class A3, class A4> struct list_av_4
1075 typedef typename add_value<A1>::type B1;
1076 typedef typename add_value<A2>::type B2;
1077 typedef typename add_value<A3>::type B3;
1078 typedef typename add_value<A4>::type B4;
1079 typedef list4<B1, B2, B3, B4> type;
1082 template<class A1, class A2, class A3, class A4, class A5> struct list_av_5
1084 typedef typename add_value<A1>::type B1;
1085 typedef typename add_value<A2>::type B2;
1086 typedef typename add_value<A3>::type B3;
1087 typedef typename add_value<A4>::type B4;
1088 typedef typename add_value<A5>::type B5;
1089 typedef list5<B1, B2, B3, B4, B5> type;
1092 template<class A1, class A2, class A3, class A4, class A5, class A6> struct list_av_6
1094 typedef typename add_value<A1>::type B1;
1095 typedef typename add_value<A2>::type B2;
1096 typedef typename add_value<A3>::type B3;
1097 typedef typename add_value<A4>::type B4;
1098 typedef typename add_value<A5>::type B5;
1099 typedef typename add_value<A6>::type B6;
1100 typedef list6<B1, B2, B3, B4, B5, B6> type;
1103 template<class A1, class A2, class A3, class A4, class A5, class A6, class A7> struct list_av_7
1105 typedef typename add_value<A1>::type B1;
1106 typedef typename add_value<A2>::type B2;
1107 typedef typename add_value<A3>::type B3;
1108 typedef typename add_value<A4>::type B4;
1109 typedef typename add_value<A5>::type B5;
1110 typedef typename add_value<A6>::type B6;
1111 typedef typename add_value<A7>::type B7;
1112 typedef list7<B1, B2, B3, B4, B5, B6, B7> type;
1115 template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> struct list_av_8
1117 typedef typename add_value<A1>::type B1;
1118 typedef typename add_value<A2>::type B2;
1119 typedef typename add_value<A3>::type B3;
1120 typedef typename add_value<A4>::type B4;
1121 typedef typename add_value<A5>::type B5;
1122 typedef typename add_value<A6>::type B6;
1123 typedef typename add_value<A7>::type B7;
1124 typedef typename add_value<A8>::type B8;
1125 typedef list8<B1, B2, B3, B4, B5, B6, B7, B8> type;
1128 template<class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> struct list_av_9
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 typename add_value<A8>::type B8;
1138 typedef typename add_value<A9>::type B9;
1139 typedef list9<B1, B2, B3, B4, B5, B6, B7, B8, B9> type;
1146 template<class V> bool operator()(V const & v) const { return !v; }
1149 template<class R, class F, class L>
1150 bind_t< bool, logical_not, list1< bind_t<R, F, L> > >
1151 operator! (bind_t<R, F, L> const & f)
1153 typedef list1< bind_t<R, F, L> > list_type;
1154 return bind_t<bool, logical_not, list_type> ( logical_not(), list_type(f) );
1157 // relational operators
1159 #define BOOST_BIND_OPERATOR( op, name ) \
1163 template<class V, class W> bool operator()(V const & v, W const & w) const { return v op w; } \
1166 template<class R, class F, class L, class A2> \
1167 bind_t< bool, name, list2< bind_t<R, F, L>, typename add_value<A2>::type > > \
1168 operator op (bind_t<R, F, L> const & f, A2 a2) \
1170 typedef typename add_value<A2>::type B2; \
1171 typedef list2< bind_t<R, F, L>, B2> list_type; \
1172 return bind_t<bool, name, list_type> ( name(), list_type(f, a2) ); \
1175 BOOST_BIND_OPERATOR( ==, equal )
1176 BOOST_BIND_OPERATOR( !=, not_equal )
1178 BOOST_BIND_OPERATOR( <, less )
1179 BOOST_BIND_OPERATOR( <=, less_equal )
1181 BOOST_BIND_OPERATOR( >, greater )
1182 BOOST_BIND_OPERATOR( >=, greater_equal )
1184 BOOST_BIND_OPERATOR( &&, logical_and )
1185 BOOST_BIND_OPERATOR( ||, logical_or )
1187 #undef BOOST_BIND_OPERATOR
1189 #if defined(__GNUC__) && BOOST_WORKAROUND(__GNUC__, < 3)
1191 // resolve ambiguity with rel_ops
1193 #define BOOST_BIND_OPERATOR( op, name ) \
1195 template<class R, class F, class L> \
1196 bind_t< bool, name, list2< bind_t<R, F, L>, bind_t<R, F, L> > > \
1197 operator op (bind_t<R, F, L> const & f, bind_t<R, F, L> const & g) \
1199 typedef list2< bind_t<R, F, L>, bind_t<R, F, L> > list_type; \
1200 return bind_t<bool, name, list_type> ( name(), list_type(f, g) ); \
1203 BOOST_BIND_OPERATOR( !=, not_equal )
1204 BOOST_BIND_OPERATOR( <=, less_equal )
1205 BOOST_BIND_OPERATOR( >, greater )
1206 BOOST_BIND_OPERATOR( >=, greater_equal )
1212 #if !defined( BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP ) && !defined( __BORLANDC__ ) \
1213 && !(defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ <= 3)
1215 template<class V, class T> void visit_each( V & v, value<T> const & t, int )
1217 using boost::visit_each;
1218 BOOST_BIND_VISIT_EACH( v, t.get(), 0 );
1221 template<class V, class R, class F, class L> void visit_each( V & v, bind_t<R, F, L> const & t, int )
1230 // visit_each, no ADL
1232 #if defined( BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP ) || defined( __BORLANDC__ ) \
1233 || (defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ <= 3)
1235 template<class V, class T> void visit_each( V & v, _bi::value<T> const & t, int )
1237 BOOST_BIND_VISIT_EACH( v, t.get(), 0 );
1240 template<class V, class R, class F, class L> void visit_each( V & v, _bi::bind_t<R, F, L> const & t, int )
1247 // is_bind_expression
1249 template< class T > struct is_bind_expression
1251 enum _vt { value = 0 };
1254 #if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
1256 template< class R, class F, class L > struct is_bind_expression< _bi::bind_t< R, F, L > >
1258 enum _vt { value = 1 };
1266 #define BOOST_BIND bind
1269 // generic function objects
1271 template<class R, class F>
1272 _bi::bind_t<R, F, _bi::list0>
1275 typedef _bi::list0 list_type;
1276 return _bi::bind_t<R, F, list_type> (f, list_type());
1279 template<class R, class F, class A1>
1280 _bi::bind_t<R, F, typename _bi::list_av_1<A1>::type>
1281 BOOST_BIND(F f, A1 a1)
1283 typedef typename _bi::list_av_1<A1>::type list_type;
1284 return _bi::bind_t<R, F, list_type> (f, list_type(a1));
1287 template<class R, class F, class A1, class A2>
1288 _bi::bind_t<R, F, typename _bi::list_av_2<A1, A2>::type>
1289 BOOST_BIND(F f, A1 a1, A2 a2)
1291 typedef typename _bi::list_av_2<A1, A2>::type list_type;
1292 return _bi::bind_t<R, F, list_type> (f, list_type(a1, a2));
1295 template<class R, class F, class A1, class A2, class A3>
1296 _bi::bind_t<R, F, typename _bi::list_av_3<A1, A2, A3>::type>
1297 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3)
1299 typedef typename _bi::list_av_3<A1, A2, A3>::type list_type;
1300 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3));
1303 template<class R, class F, class A1, class A2, class A3, class A4>
1304 _bi::bind_t<R, F, typename _bi::list_av_4<A1, A2, A3, A4>::type>
1305 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4)
1307 typedef typename _bi::list_av_4<A1, A2, A3, A4>::type list_type;
1308 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4));
1311 template<class R, class F, class A1, class A2, class A3, class A4, class A5>
1312 _bi::bind_t<R, F, typename _bi::list_av_5<A1, A2, A3, A4, A5>::type>
1313 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5)
1315 typedef typename _bi::list_av_5<A1, A2, A3, A4, A5>::type list_type;
1316 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5));
1319 template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6>
1320 _bi::bind_t<R, F, typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type>
1321 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6)
1323 typedef typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type list_type;
1324 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6));
1327 template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7>
1328 _bi::bind_t<R, F, typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type>
1329 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7)
1331 typedef typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type list_type;
1332 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7));
1335 template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
1336 _bi::bind_t<R, F, typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type>
1337 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8)
1339 typedef typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type list_type;
1340 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8));
1343 template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9>
1344 _bi::bind_t<R, F, typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type>
1345 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9)
1347 typedef typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type list_type;
1348 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9));
1351 // generic function objects, alternative syntax
1353 template<class R, class F>
1354 _bi::bind_t<R, F, _bi::list0>
1355 BOOST_BIND(boost::type<R>, F f)
1357 typedef _bi::list0 list_type;
1358 return _bi::bind_t<R, F, list_type> (f, list_type());
1361 template<class R, class F, class A1>
1362 _bi::bind_t<R, F, typename _bi::list_av_1<A1>::type>
1363 BOOST_BIND(boost::type<R>, F f, A1 a1)
1365 typedef typename _bi::list_av_1<A1>::type list_type;
1366 return _bi::bind_t<R, F, list_type> (f, list_type(a1));
1369 template<class R, class F, class A1, class A2>
1370 _bi::bind_t<R, F, typename _bi::list_av_2<A1, A2>::type>
1371 BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2)
1373 typedef typename _bi::list_av_2<A1, A2>::type list_type;
1374 return _bi::bind_t<R, F, list_type> (f, list_type(a1, a2));
1377 template<class R, class F, class A1, class A2, class A3>
1378 _bi::bind_t<R, F, typename _bi::list_av_3<A1, A2, A3>::type>
1379 BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3)
1381 typedef typename _bi::list_av_3<A1, A2, A3>::type list_type;
1382 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3));
1385 template<class R, class F, class A1, class A2, class A3, class A4>
1386 _bi::bind_t<R, F, typename _bi::list_av_4<A1, A2, A3, A4>::type>
1387 BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3, A4 a4)
1389 typedef typename _bi::list_av_4<A1, A2, A3, A4>::type list_type;
1390 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4));
1393 template<class R, class F, class A1, class A2, class A3, class A4, class A5>
1394 _bi::bind_t<R, F, typename _bi::list_av_5<A1, A2, A3, A4, A5>::type>
1395 BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5)
1397 typedef typename _bi::list_av_5<A1, A2, A3, A4, A5>::type list_type;
1398 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5));
1401 template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6>
1402 _bi::bind_t<R, F, typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type>
1403 BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6)
1405 typedef typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type list_type;
1406 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6));
1409 template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7>
1410 _bi::bind_t<R, F, typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type>
1411 BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7)
1413 typedef typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type list_type;
1414 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7));
1417 template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
1418 _bi::bind_t<R, F, typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type>
1419 BOOST_BIND(boost::type<R>, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8)
1421 typedef typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type list_type;
1422 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8));
1425 template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9>
1426 _bi::bind_t<R, F, typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type>
1427 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)
1429 typedef typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type list_type;
1430 return _bi::bind_t<R, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9));
1433 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
1435 // adaptable function objects
1438 _bi::bind_t<_bi::unspecified, F, _bi::list0>
1441 typedef _bi::list0 list_type;
1442 return _bi::bind_t<_bi::unspecified, F, list_type> (f, list_type());
1445 template<class F, class A1>
1446 _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_1<A1>::type>
1447 BOOST_BIND(F f, A1 a1)
1449 typedef typename _bi::list_av_1<A1>::type list_type;
1450 return _bi::bind_t<_bi::unspecified, F, list_type> (f, list_type(a1));
1453 template<class F, class A1, class A2>
1454 _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_2<A1, A2>::type>
1455 BOOST_BIND(F f, A1 a1, A2 a2)
1457 typedef typename _bi::list_av_2<A1, A2>::type list_type;
1458 return _bi::bind_t<_bi::unspecified, F, list_type> (f, list_type(a1, a2));
1461 template<class F, class A1, class A2, class A3>
1462 _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_3<A1, A2, A3>::type>
1463 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3)
1465 typedef typename _bi::list_av_3<A1, A2, A3>::type list_type;
1466 return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3));
1469 template<class F, class A1, class A2, class A3, class A4>
1470 _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_4<A1, A2, A3, A4>::type>
1471 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4)
1473 typedef typename _bi::list_av_4<A1, A2, A3, A4>::type list_type;
1474 return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4));
1477 template<class F, class A1, class A2, class A3, class A4, class A5>
1478 _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_5<A1, A2, A3, A4, A5>::type>
1479 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5)
1481 typedef typename _bi::list_av_5<A1, A2, A3, A4, A5>::type list_type;
1482 return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5));
1485 template<class F, class A1, class A2, class A3, class A4, class A5, class A6>
1486 _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type>
1487 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6)
1489 typedef typename _bi::list_av_6<A1, A2, A3, A4, A5, A6>::type list_type;
1490 return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6));
1493 template<class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7>
1494 _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type>
1495 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7)
1497 typedef typename _bi::list_av_7<A1, A2, A3, A4, A5, A6, A7>::type list_type;
1498 return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7));
1501 template<class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
1502 _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type>
1503 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8)
1505 typedef typename _bi::list_av_8<A1, A2, A3, A4, A5, A6, A7, A8>::type list_type;
1506 return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8));
1509 template<class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9>
1510 _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type>
1511 BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9)
1513 typedef typename _bi::list_av_9<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type list_type;
1514 return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9));
1517 #endif // !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
1519 // function pointers
1521 #define BOOST_BIND_CC
1522 #define BOOST_BIND_ST
1524 #include <boost/bind/bind_cc.hpp>
1526 #undef BOOST_BIND_CC
1527 #undef BOOST_BIND_ST
1529 #ifdef BOOST_BIND_ENABLE_STDCALL
1531 #define BOOST_BIND_CC __stdcall
1532 #define BOOST_BIND_ST
1534 #include <boost/bind/bind_cc.hpp>
1536 #undef BOOST_BIND_CC
1537 #undef BOOST_BIND_ST
1541 #ifdef BOOST_BIND_ENABLE_FASTCALL
1543 #define BOOST_BIND_CC __fastcall
1544 #define BOOST_BIND_ST
1546 #include <boost/bind/bind_cc.hpp>
1548 #undef BOOST_BIND_CC
1549 #undef BOOST_BIND_ST
1553 #ifdef BOOST_BIND_ENABLE_PASCAL
1555 #define BOOST_BIND_ST pascal
1556 #define BOOST_BIND_CC
1558 #include <boost/bind/bind_cc.hpp>
1560 #undef BOOST_BIND_ST
1561 #undef BOOST_BIND_CC
1565 // member function pointers
1567 #define BOOST_BIND_MF_NAME(X) X
1568 #define BOOST_BIND_MF_CC
1570 #include <boost/bind/bind_mf_cc.hpp>
1571 #include <boost/bind/bind_mf2_cc.hpp>
1573 #undef BOOST_BIND_MF_NAME
1574 #undef BOOST_BIND_MF_CC
1576 #ifdef BOOST_MEM_FN_ENABLE_CDECL
1578 #define BOOST_BIND_MF_NAME(X) X##_cdecl
1579 #define BOOST_BIND_MF_CC __cdecl
1581 #include <boost/bind/bind_mf_cc.hpp>
1582 #include <boost/bind/bind_mf2_cc.hpp>
1584 #undef BOOST_BIND_MF_NAME
1585 #undef BOOST_BIND_MF_CC
1589 #ifdef BOOST_MEM_FN_ENABLE_STDCALL
1591 #define BOOST_BIND_MF_NAME(X) X##_stdcall
1592 #define BOOST_BIND_MF_CC __stdcall
1594 #include <boost/bind/bind_mf_cc.hpp>
1595 #include <boost/bind/bind_mf2_cc.hpp>
1597 #undef BOOST_BIND_MF_NAME
1598 #undef BOOST_BIND_MF_CC
1602 #ifdef BOOST_MEM_FN_ENABLE_FASTCALL
1604 #define BOOST_BIND_MF_NAME(X) X##_fastcall
1605 #define BOOST_BIND_MF_CC __fastcall
1607 #include <boost/bind/bind_mf_cc.hpp>
1608 #include <boost/bind/bind_mf2_cc.hpp>
1610 #undef BOOST_BIND_MF_NAME
1611 #undef BOOST_BIND_MF_CC
1615 // data member pointers
1617 #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) || defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \
1618 || ( defined(__BORLANDC__) && BOOST_WORKAROUND( __BORLANDC__, < 0x600 ) )
1620 template<class R, class T, class A1>
1621 _bi::bind_t< R, _mfi::dm<R, T>, typename _bi::list_av_1<A1>::type >
1622 BOOST_BIND(R T::*f, A1 a1)
1624 typedef _mfi::dm<R, T> F;
1625 typedef typename _bi::list_av_1<A1>::type list_type;
1626 return _bi::bind_t<R, F, list_type>( F(f), list_type(a1) );
1634 template< class Pm, int I > struct add_cref;
1636 template< class M, class T > struct add_cref< M T::*, 0 >
1641 template< class M, class T > struct add_cref< M T::*, 1 >
1643 typedef M const & type;
1646 template< class R, class T > struct add_cref< R (T::*) (), 1 >
1651 #if !( defined(__IBMCPP__) && BOOST_WORKAROUND( __IBMCPP__, BOOST_TESTED_AT(600) ) )
1653 template< class R, class T > struct add_cref< R (T::*) () const, 1 >
1658 #endif // __IBMCPP__
1660 template<class R> struct isref
1662 enum value_type { value = 0 };
1665 template<class R> struct isref< R& >
1667 enum value_type { value = 1 };
1670 template<class R> struct isref< R* >
1672 enum value_type { value = 1 };
1675 template<class Pm, class A1> struct dm_result
1677 typedef typename add_cref< Pm, 1 >::type type;
1680 template<class Pm, class R, class F, class L> struct dm_result< Pm, bind_t<R, F, L> >
1682 typedef typename bind_t<R, F, L>::result_type result_type;
1683 typedef typename add_cref< Pm, isref< result_type >::value >::type type;
1688 template< class A1, class M, class T >
1691 typename _bi::dm_result< M T::*, A1 >::type,
1693 typename _bi::list_av_1<A1>::type
1696 BOOST_BIND( M T::*f, A1 a1 )
1698 typedef typename _bi::dm_result< M T::*, A1 >::type result_type;
1699 typedef _mfi::dm<M, T> F;
1700 typedef typename _bi::list_av_1<A1>::type list_type;
1701 return _bi::bind_t< result_type, F, list_type >( F( f ), list_type( a1 ) );
1706 } // namespace boost
1708 #ifndef BOOST_BIND_NO_PLACEHOLDERS
1710 # include <boost/bind/placeholders.hpp>
1715 # pragma warning(default: 4512) // assignment operator could not be generated
1716 # pragma warning(pop)
1719 #endif // #ifndef BOOST_BIND_HPP_INCLUDED