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