#ifndef BOOST_BIND_BIND_HPP_INCLUDED #define BOOST_BIND_BIND_HPP_INCLUDED // MS compatible compilers support #pragma once #if defined(_MSC_VER) && (_MSC_VER >= 1020) # pragma once #endif // // bind.hpp - binds function objects to arguments // // Copyright (c) 2001-2004 Peter Dimov and Multi Media Ltd. // Copyright (c) 2001 David Abrahams // Copyright (c) 2005 Peter Dimov // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // See http://www.boost.org/libs/bind/bind.html for documentation. // #include #include #include #include #include #include #include #include #include #include #include #include #if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) #include // std::forward #endif // Borland-specific bug, visit_each() silently fails to produce code #if defined(BOOST_BORLANDC) # define BOOST_BIND_VISIT_EACH boost::visit_each #else # define BOOST_BIND_VISIT_EACH visit_each #endif #include #ifdef BOOST_MSVC # pragma warning(push) # pragma warning(disable: 4512) // assignment operator could not be generated #endif namespace boost { template class weak_ptr; namespace _bi // implementation details { // ref_compare template bool ref_compare( T const & a, T const & b, long ) { return a == b; } template bool ref_compare( arg const &, arg const &, int ) { return true; } template bool ref_compare( arg (*) (), arg (*) (), int ) { return true; } template bool ref_compare( reference_wrapper const & a, reference_wrapper const & b, int ) { return a.get_pointer() == b.get_pointer(); } // bind_t forward declaration for listN template class bind_t; template bool ref_compare( bind_t const & a, bind_t const & b, int ) { return a.compare( b ); } // value template class value { public: value(T const & t): t_(t) {} T & get() { return t_; } T const & get() const { return t_; } bool operator==(value const & rhs) const { return t_ == rhs.t_; } private: T t_; }; // ref_compare for weak_ptr template bool ref_compare( value< weak_ptr > const & a, value< weak_ptr > const & b, int ) { return !(a.get() < b.get()) && !(b.get() < a.get()); } // type template class type {}; // unwrap template struct unwrapper { static inline F & unwrap( F & f, long ) { return f; } template static inline F2 & unwrap( reference_wrapper rf, int ) { return rf.get(); } template static inline _mfi::dm unwrap( R T::* pm, int ) { return _mfi::dm( pm ); } }; // listN class list0 { public: list0() {} template T & operator[] (_bi::value & v) const { return v.get(); } template T const & operator[] (_bi::value const & v) const { return v.get(); } template T & operator[] (reference_wrapper const & v) const { return v.get(); } template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } template R operator()(type, F & f, A &, long) { return unwrapper::unwrap(f, 0)(); } template R operator()(type, F const & f, A &, long) const { return unwrapper::unwrap(f, 0)(); } template void operator()(type, F & f, A &, int) { unwrapper::unwrap(f, 0)(); } template void operator()(type, F const & f, A &, int) const { unwrapper::unwrap(f, 0)(); } template void accept(V &) const { } bool operator==(list0 const &) const { return true; } }; #ifdef BOOST_MSVC // MSVC is bright enough to realise that the parameter rhs // in operator==may be unused for some template argument types: #pragma warning(push) #pragma warning(disable:4100) #endif template< class A1 > class list1: private storage1< A1 > { private: typedef storage1< A1 > base_type; public: explicit list1( A1 a1 ): base_type( a1 ) {} A1 operator[] (boost::arg<1>) const { return base_type::a1_; } A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } template T & operator[] ( _bi::value & v ) const { return v.get(); } template T const & operator[] ( _bi::value const & v ) const { return v.get(); } template T & operator[] (reference_wrapper const & v) const { return v.get(); } template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } template R operator()(type, F & f, A & a, long) { return unwrapper::unwrap(f, 0)(a[base_type::a1_]); } template R operator()(type, F const & f, A & a, long) const { return unwrapper::unwrap(f, 0)(a[base_type::a1_]); } template void operator()(type, F & f, A & a, int) { unwrapper::unwrap(f, 0)(a[base_type::a1_]); } template void operator()(type, F const & f, A & a, int) const { unwrapper::unwrap(f, 0)(a[base_type::a1_]); } template void accept(V & v) const { base_type::accept(v); } bool operator==(list1 const & rhs) const { return ref_compare(base_type::a1_, rhs.a1_, 0); } }; struct logical_and; struct logical_or; template< class A1, class A2 > class list2: private storage2< A1, A2 > { private: typedef storage2< A1, A2 > base_type; public: list2( A1 a1, A2 a2 ): base_type( a1, a2 ) {} A1 operator[] (boost::arg<1>) const { return base_type::a1_; } A2 operator[] (boost::arg<2>) const { return base_type::a2_; } A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; } template T & operator[] (_bi::value & v) const { return v.get(); } template T const & operator[] (_bi::value const & v) const { return v.get(); } template T & operator[] (reference_wrapper const & v) const { return v.get(); } template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } template R operator()(type, F & f, A & a, long) { return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]); } template R operator()(type, F const & f, A & a, long) const { return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]); } template void operator()(type, F & f, A & a, int) { unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]); } template void operator()(type, F const & f, A & a, int) const { unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]); } template bool operator()( type, logical_and & /*f*/, A & a, int ) { return a[ base_type::a1_ ] && a[ base_type::a2_ ]; } template bool operator()( type, logical_and const & /*f*/, A & a, int ) const { return a[ base_type::a1_ ] && a[ base_type::a2_ ]; } template bool operator()( type, logical_or & /*f*/, A & a, int ) { return a[ base_type::a1_ ] || a[ base_type::a2_ ]; } template bool operator()( type, logical_or const & /*f*/, A & a, int ) const { return a[ base_type::a1_ ] || a[ base_type::a2_ ]; } template void accept(V & v) const { base_type::accept(v); } bool operator==(list2 const & rhs) const { return ref_compare(base_type::a1_, rhs.a1_, 0) && ref_compare(base_type::a2_, rhs.a2_, 0); } }; template< class A1, class A2, class A3 > class list3: private storage3< A1, A2, A3 > { private: typedef storage3< A1, A2, A3 > base_type; public: list3( A1 a1, A2 a2, A3 a3 ): base_type( a1, a2, a3 ) {} A1 operator[] (boost::arg<1>) const { return base_type::a1_; } A2 operator[] (boost::arg<2>) const { return base_type::a2_; } A3 operator[] (boost::arg<3>) const { return base_type::a3_; } A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; } A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; } template T & operator[] (_bi::value & v) const { return v.get(); } template T const & operator[] (_bi::value const & v) const { return v.get(); } template T & operator[] (reference_wrapper const & v) const { return v.get(); } template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } template R operator()(type, F & f, A & a, long) { return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]); } template R operator()(type, F const & f, A & a, long) const { return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]); } template void operator()(type, F & f, A & a, int) { unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]); } template void operator()(type, F const & f, A & a, int) const { unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]); } template void accept(V & v) const { base_type::accept(v); } bool operator==(list3 const & rhs) const { return ref_compare( base_type::a1_, rhs.a1_, 0 ) && ref_compare( base_type::a2_, rhs.a2_, 0 ) && ref_compare( base_type::a3_, rhs.a3_, 0 ); } }; template< class A1, class A2, class A3, class A4 > class list4: private storage4< A1, A2, A3, A4 > { private: typedef storage4< A1, A2, A3, A4 > base_type; public: list4( A1 a1, A2 a2, A3 a3, A4 a4 ): base_type( a1, a2, a3, a4 ) {} A1 operator[] (boost::arg<1>) const { return base_type::a1_; } A2 operator[] (boost::arg<2>) const { return base_type::a2_; } A3 operator[] (boost::arg<3>) const { return base_type::a3_; } A4 operator[] (boost::arg<4>) const { return base_type::a4_; } A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; } A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; } A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; } template T & operator[] (_bi::value & v) const { return v.get(); } template T const & operator[] (_bi::value const & v) const { return v.get(); } template T & operator[] (reference_wrapper const & v) const { return v.get(); } template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } template R operator()(type, F & f, A & a, long) { return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]); } template R operator()(type, F const & f, A & a, long) const { return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]); } template void operator()(type, F & f, A & a, int) { unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]); } template void operator()(type, F const & f, A & a, int) const { unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]); } template void accept(V & v) const { base_type::accept(v); } bool operator==(list4 const & rhs) const { return ref_compare( base_type::a1_, rhs.a1_, 0 ) && ref_compare( base_type::a2_, rhs.a2_, 0 ) && ref_compare( base_type::a3_, rhs.a3_, 0 ) && ref_compare( base_type::a4_, rhs.a4_, 0 ); } }; template< class A1, class A2, class A3, class A4, class A5 > class list5: private storage5< A1, A2, A3, A4, A5 > { private: typedef storage5< A1, A2, A3, A4, A5 > base_type; public: list5( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5 ): base_type( a1, a2, a3, a4, a5 ) {} A1 operator[] (boost::arg<1>) const { return base_type::a1_; } A2 operator[] (boost::arg<2>) const { return base_type::a2_; } A3 operator[] (boost::arg<3>) const { return base_type::a3_; } A4 operator[] (boost::arg<4>) const { return base_type::a4_; } A5 operator[] (boost::arg<5>) const { return base_type::a5_; } A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; } A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; } A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; } A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; } template T & operator[] (_bi::value & v) const { return v.get(); } template T const & operator[] (_bi::value const & v) const { return v.get(); } template T & operator[] (reference_wrapper const & v) const { return v.get(); } template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } template R operator()(type, F & f, A & a, long) { return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_]); } template R operator()(type, F const & f, A & a, long) const { return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_]); } template void operator()(type, F & f, A & a, int) { unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_]); } template void operator()(type, F const & f, A & a, int) const { unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_]); } template void accept(V & v) const { base_type::accept(v); } bool operator==(list5 const & rhs) const { return ref_compare( base_type::a1_, rhs.a1_, 0 ) && ref_compare( base_type::a2_, rhs.a2_, 0 ) && ref_compare( base_type::a3_, rhs.a3_, 0 ) && ref_compare( base_type::a4_, rhs.a4_, 0 ) && ref_compare( base_type::a5_, rhs.a5_, 0 ); } }; template class list6: private storage6< A1, A2, A3, A4, A5, A6 > { private: typedef storage6< A1, A2, A3, A4, A5, A6 > base_type; public: list6( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6 ): base_type( a1, a2, a3, a4, a5, a6 ) {} A1 operator[] (boost::arg<1>) const { return base_type::a1_; } A2 operator[] (boost::arg<2>) const { return base_type::a2_; } A3 operator[] (boost::arg<3>) const { return base_type::a3_; } A4 operator[] (boost::arg<4>) const { return base_type::a4_; } A5 operator[] (boost::arg<5>) const { return base_type::a5_; } A6 operator[] (boost::arg<6>) const { return base_type::a6_; } A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; } A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; } A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; } A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; } A6 operator[] (boost::arg<6> (*) ()) const { return base_type::a6_; } template T & operator[] (_bi::value & v) const { return v.get(); } template T const & operator[] (_bi::value const & v) const { return v.get(); } template T & operator[] (reference_wrapper const & v) const { return v.get(); } template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } template R operator()(type, F & f, A & a, long) { return unwrapper::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_]); } template R operator()(type, F const & f, A & a, long) const { return unwrapper::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_]); } template void operator()(type, F & f, A & a, int) { unwrapper::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_]); } template void operator()(type, F const & f, A & a, int) const { unwrapper::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_]); } template void accept(V & v) const { base_type::accept(v); } bool operator==(list6 const & rhs) const { return ref_compare( base_type::a1_, rhs.a1_, 0 ) && ref_compare( base_type::a2_, rhs.a2_, 0 ) && ref_compare( base_type::a3_, rhs.a3_, 0 ) && ref_compare( base_type::a4_, rhs.a4_, 0 ) && ref_compare( base_type::a5_, rhs.a5_, 0 ) && ref_compare( base_type::a6_, rhs.a6_, 0 ); } }; template class list7: private storage7< A1, A2, A3, A4, A5, A6, A7 > { private: typedef storage7< A1, A2, A3, A4, A5, A6, A7 > base_type; public: list7( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7 ): base_type( a1, a2, a3, a4, a5, a6, a7 ) {} A1 operator[] (boost::arg<1>) const { return base_type::a1_; } A2 operator[] (boost::arg<2>) const { return base_type::a2_; } A3 operator[] (boost::arg<3>) const { return base_type::a3_; } A4 operator[] (boost::arg<4>) const { return base_type::a4_; } A5 operator[] (boost::arg<5>) const { return base_type::a5_; } A6 operator[] (boost::arg<6>) const { return base_type::a6_; } A7 operator[] (boost::arg<7>) const { return base_type::a7_; } A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; } A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; } A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; } A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; } A6 operator[] (boost::arg<6> (*) ()) const { return base_type::a6_; } A7 operator[] (boost::arg<7> (*) ()) const { return base_type::a7_; } template T & operator[] (_bi::value & v) const { return v.get(); } template T const & operator[] (_bi::value const & v) const { return v.get(); } template T & operator[] (reference_wrapper const & v) const { return v.get(); } template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } template R operator()(type, F & f, A & a, long) { return unwrapper::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_]); } template R operator()(type, F const & f, A & a, long) const { return unwrapper::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_]); } template void operator()(type, F & f, A & a, int) { unwrapper::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_]); } template void operator()(type, F const & f, A & a, int) const { unwrapper::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_]); } template void accept(V & v) const { base_type::accept(v); } bool operator==(list7 const & rhs) const { return ref_compare( base_type::a1_, rhs.a1_, 0 ) && ref_compare( base_type::a2_, rhs.a2_, 0 ) && ref_compare( base_type::a3_, rhs.a3_, 0 ) && ref_compare( base_type::a4_, rhs.a4_, 0 ) && ref_compare( base_type::a5_, rhs.a5_, 0 ) && ref_compare( base_type::a6_, rhs.a6_, 0 ) && ref_compare( base_type::a7_, rhs.a7_, 0 ); } }; 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 > { private: typedef storage8< A1, A2, A3, A4, A5, A6, A7, A8 > base_type; public: 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 ) {} A1 operator[] (boost::arg<1>) const { return base_type::a1_; } A2 operator[] (boost::arg<2>) const { return base_type::a2_; } A3 operator[] (boost::arg<3>) const { return base_type::a3_; } A4 operator[] (boost::arg<4>) const { return base_type::a4_; } A5 operator[] (boost::arg<5>) const { return base_type::a5_; } A6 operator[] (boost::arg<6>) const { return base_type::a6_; } A7 operator[] (boost::arg<7>) const { return base_type::a7_; } A8 operator[] (boost::arg<8>) const { return base_type::a8_; } A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; } A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; } A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; } A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; } A6 operator[] (boost::arg<6> (*) ()) const { return base_type::a6_; } A7 operator[] (boost::arg<7> (*) ()) const { return base_type::a7_; } A8 operator[] (boost::arg<8> (*) ()) const { return base_type::a8_; } template T & operator[] (_bi::value & v) const { return v.get(); } template T const & operator[] (_bi::value const & v) const { return v.get(); } template T & operator[] (reference_wrapper const & v) const { return v.get(); } template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } template R operator()(type, F & f, A & a, long) { return unwrapper::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_]); } template R operator()(type, F const & f, A & a, long) const { return unwrapper::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_]); } template void operator()(type, F & f, A & a, int) { unwrapper::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_]); } template void operator()(type, F const & f, A & a, int) const { unwrapper::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_]); } template void accept(V & v) const { base_type::accept(v); } bool operator==(list8 const & rhs) const { return ref_compare( base_type::a1_, rhs.a1_, 0 ) && ref_compare( base_type::a2_, rhs.a2_, 0 ) && ref_compare( base_type::a3_, rhs.a3_, 0 ) && ref_compare( base_type::a4_, rhs.a4_, 0 ) && ref_compare( base_type::a5_, rhs.a5_, 0 ) && ref_compare( base_type::a6_, rhs.a6_, 0 ) && ref_compare( base_type::a7_, rhs.a7_, 0 ) && ref_compare( base_type::a8_, rhs.a8_, 0 ); } }; template class list9: private storage9< A1, A2, A3, A4, A5, A6, A7, A8, A9 > { private: typedef storage9< A1, A2, A3, A4, A5, A6, A7, A8, A9 > base_type; public: 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 ) {} A1 operator[] (boost::arg<1>) const { return base_type::a1_; } A2 operator[] (boost::arg<2>) const { return base_type::a2_; } A3 operator[] (boost::arg<3>) const { return base_type::a3_; } A4 operator[] (boost::arg<4>) const { return base_type::a4_; } A5 operator[] (boost::arg<5>) const { return base_type::a5_; } A6 operator[] (boost::arg<6>) const { return base_type::a6_; } A7 operator[] (boost::arg<7>) const { return base_type::a7_; } A8 operator[] (boost::arg<8>) const { return base_type::a8_; } A9 operator[] (boost::arg<9>) const { return base_type::a9_; } A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; } A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; } A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; } A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; } A6 operator[] (boost::arg<6> (*) ()) const { return base_type::a6_; } A7 operator[] (boost::arg<7> (*) ()) const { return base_type::a7_; } A8 operator[] (boost::arg<8> (*) ()) const { return base_type::a8_; } A9 operator[] (boost::arg<9> (*) ()) const { return base_type::a9_; } template T & operator[] (_bi::value & v) const { return v.get(); } template T const & operator[] (_bi::value const & v) const { return v.get(); } template T & operator[] (reference_wrapper const & v) const { return v.get(); } template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } template R operator()(type, F & f, A & a, long) { return unwrapper::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_]); } template R operator()(type, F const & f, A & a, long) const { return unwrapper::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_]); } template void operator()(type, F & f, A & a, int) { unwrapper::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_]); } template void operator()(type, F const & f, A & a, int) const { unwrapper::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_]); } template void accept(V & v) const { base_type::accept(v); } bool operator==(list9 const & rhs) const { return ref_compare( base_type::a1_, rhs.a1_, 0 ) && ref_compare( base_type::a2_, rhs.a2_, 0 ) && ref_compare( base_type::a3_, rhs.a3_, 0 ) && ref_compare( base_type::a4_, rhs.a4_, 0 ) && ref_compare( base_type::a5_, rhs.a5_, 0 ) && ref_compare( base_type::a6_, rhs.a6_, 0 ) && ref_compare( base_type::a7_, rhs.a7_, 0 ) && ref_compare( base_type::a8_, rhs.a8_, 0 ) && ref_compare( base_type::a9_, rhs.a9_, 0 ); } }; #ifdef BOOST_MSVC #pragma warning(pop) #endif // bind_t #if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) template< class A1 > class rrlist1 { private: A1 & a1_; // not A1&& because of msvc-10.0 public: explicit rrlist1( A1 & a1 ): a1_( a1 ) {} A1 && operator[] (boost::arg<1>) const { return std::forward( a1_ ); } // not static_cast because of g++ 4.9 A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward( a1_ ); } template T & operator[] ( _bi::value & v ) const { return v.get(); } template T const & operator[] ( _bi::value const & v ) const { return v.get(); } template T & operator[] (reference_wrapper const & v) const { return v.get(); } template typename result_traits::type operator[] (bind_t & b) const { rrlist1 a( a1_ ); return b.eval( a ); } template typename result_traits::type operator[] (bind_t const & b) const { rrlist1 a( a1_ ); return b.eval( a ); } }; template< class A1, class A2 > class rrlist2 { private: A1 & a1_; A2 & a2_; public: rrlist2( A1 & a1, A2 & a2 ): a1_( a1 ), a2_( a2 ) {} A1 && operator[] (boost::arg<1>) const { return std::forward( a1_ ); } A2 && operator[] (boost::arg<2>) const { return std::forward( a2_ ); } A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward( a1_ ); } A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward( a2_ ); } template T & operator[] ( _bi::value & v ) const { return v.get(); } template T const & operator[] ( _bi::value const & v ) const { return v.get(); } template T & operator[] (reference_wrapper const & v) const { return v.get(); } template typename result_traits::type operator[] (bind_t & b) const { rrlist2 a( a1_, a2_ ); return b.eval( a ); } template typename result_traits::type operator[] (bind_t const & b) const { rrlist2 a( a1_, a2_ ); return b.eval( a ); } }; template< class A1, class A2, class A3 > class rrlist3 { private: A1 & a1_; A2 & a2_; A3 & a3_; public: rrlist3( A1 & a1, A2 & a2, A3 & a3 ): a1_( a1 ), a2_( a2 ), a3_( a3 ) {} A1 && operator[] (boost::arg<1>) const { return std::forward( a1_ ); } A2 && operator[] (boost::arg<2>) const { return std::forward( a2_ ); } A3 && operator[] (boost::arg<3>) const { return std::forward( a3_ ); } A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward( a1_ ); } A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward( a2_ ); } A3 && operator[] (boost::arg<3> (*) ()) const { return std::forward( a3_ ); } template T & operator[] ( _bi::value & v ) const { return v.get(); } template T const & operator[] ( _bi::value const & v ) const { return v.get(); } template T & operator[] (reference_wrapper const & v) const { return v.get(); } template typename result_traits::type operator[] (bind_t & b) const { rrlist3 a( a1_, a2_, a3_ ); return b.eval( a ); } template typename result_traits::type operator[] (bind_t const & b) const { rrlist3 a( a1_, a2_, a3_ ); return b.eval( a ); } }; template< class A1, class A2, class A3, class A4 > class rrlist4 { private: A1 & a1_; A2 & a2_; A3 & a3_; A4 & a4_; public: rrlist4( A1 & a1, A2 & a2, A3 & a3, A4 & a4 ): a1_( a1 ), a2_( a2 ), a3_( a3 ), a4_( a4 ) {} A1 && operator[] (boost::arg<1>) const { return std::forward( a1_ ); } A2 && operator[] (boost::arg<2>) const { return std::forward( a2_ ); } A3 && operator[] (boost::arg<3>) const { return std::forward( a3_ ); } A4 && operator[] (boost::arg<4>) const { return std::forward( a4_ ); } A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward( a1_ ); } A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward( a2_ ); } A3 && operator[] (boost::arg<3> (*) ()) const { return std::forward( a3_ ); } A4 && operator[] (boost::arg<4> (*) ()) const { return std::forward( a4_ ); } template T & operator[] ( _bi::value & v ) const { return v.get(); } template T const & operator[] ( _bi::value const & v ) const { return v.get(); } template T & operator[] (reference_wrapper const & v) const { return v.get(); } template typename result_traits::type operator[] (bind_t & b) const { rrlist4 a( a1_, a2_, a3_, a4_ ); return b.eval( a ); } template typename result_traits::type operator[] (bind_t const & b) const { rrlist4 a( a1_, a2_, a3_, a4_ ); return b.eval( a ); } }; template< class A1, class A2, class A3, class A4, class A5 > class rrlist5 { private: A1 & a1_; A2 & a2_; A3 & a3_; A4 & a4_; A5 & a5_; public: rrlist5( A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5 ): a1_( a1 ), a2_( a2 ), a3_( a3 ), a4_( a4 ), a5_( a5 ) {} A1 && operator[] (boost::arg<1>) const { return std::forward( a1_ ); } A2 && operator[] (boost::arg<2>) const { return std::forward( a2_ ); } A3 && operator[] (boost::arg<3>) const { return std::forward( a3_ ); } A4 && operator[] (boost::arg<4>) const { return std::forward( a4_ ); } A5 && operator[] (boost::arg<5>) const { return std::forward( a5_ ); } A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward( a1_ ); } A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward( a2_ ); } A3 && operator[] (boost::arg<3> (*) ()) const { return std::forward( a3_ ); } A4 && operator[] (boost::arg<4> (*) ()) const { return std::forward( a4_ ); } A5 && operator[] (boost::arg<5> (*) ()) const { return std::forward( a5_ ); } template T & operator[] ( _bi::value & v ) const { return v.get(); } template T const & operator[] ( _bi::value const & v ) const { return v.get(); } template T & operator[] (reference_wrapper const & v) const { return v.get(); } template typename result_traits::type operator[] (bind_t & b) const { rrlist5 a( a1_, a2_, a3_, a4_, a5_ ); return b.eval( a ); } template typename result_traits::type operator[] (bind_t const & b) const { rrlist5 a( a1_, a2_, a3_, a4_, a5_ ); return b.eval( a ); } }; template< class A1, class A2, class A3, class A4, class A5, class A6 > class rrlist6 { private: A1 & a1_; A2 & a2_; A3 & a3_; A4 & a4_; A5 & a5_; A6 & a6_; public: rrlist6( A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6 ): a1_( a1 ), a2_( a2 ), a3_( a3 ), a4_( a4 ), a5_( a5 ), a6_( a6 ) {} A1 && operator[] (boost::arg<1>) const { return std::forward( a1_ ); } A2 && operator[] (boost::arg<2>) const { return std::forward( a2_ ); } A3 && operator[] (boost::arg<3>) const { return std::forward( a3_ ); } A4 && operator[] (boost::arg<4>) const { return std::forward( a4_ ); } A5 && operator[] (boost::arg<5>) const { return std::forward( a5_ ); } A6 && operator[] (boost::arg<6>) const { return std::forward( a6_ ); } A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward( a1_ ); } A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward( a2_ ); } A3 && operator[] (boost::arg<3> (*) ()) const { return std::forward( a3_ ); } A4 && operator[] (boost::arg<4> (*) ()) const { return std::forward( a4_ ); } A5 && operator[] (boost::arg<5> (*) ()) const { return std::forward( a5_ ); } A6 && operator[] (boost::arg<6> (*) ()) const { return std::forward( a6_ ); } template T & operator[] ( _bi::value & v ) const { return v.get(); } template T const & operator[] ( _bi::value const & v ) const { return v.get(); } template T & operator[] (reference_wrapper const & v) const { return v.get(); } template typename result_traits::type operator[] (bind_t & b) const { rrlist6 a( a1_, a2_, a3_, a4_, a5_, a6_ ); return b.eval( a ); } template typename result_traits::type operator[] (bind_t const & b) const { rrlist6 a( a1_, a2_, a3_, a4_, a5_, a6_ ); return b.eval( a ); } }; template< class A1, class A2, class A3, class A4, class A5, class A6, class A7 > class rrlist7 { private: A1 & a1_; A2 & a2_; A3 & a3_; A4 & a4_; A5 & a5_; A6 & a6_; A7 & a7_; public: rrlist7( A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7 ): a1_( a1 ), a2_( a2 ), a3_( a3 ), a4_( a4 ), a5_( a5 ), a6_( a6 ), a7_( a7 ) {} A1 && operator[] (boost::arg<1>) const { return std::forward( a1_ ); } A2 && operator[] (boost::arg<2>) const { return std::forward( a2_ ); } A3 && operator[] (boost::arg<3>) const { return std::forward( a3_ ); } A4 && operator[] (boost::arg<4>) const { return std::forward( a4_ ); } A5 && operator[] (boost::arg<5>) const { return std::forward( a5_ ); } A6 && operator[] (boost::arg<6>) const { return std::forward( a6_ ); } A7 && operator[] (boost::arg<7>) const { return std::forward( a7_ ); } A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward( a1_ ); } A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward( a2_ ); } A3 && operator[] (boost::arg<3> (*) ()) const { return std::forward( a3_ ); } A4 && operator[] (boost::arg<4> (*) ()) const { return std::forward( a4_ ); } A5 && operator[] (boost::arg<5> (*) ()) const { return std::forward( a5_ ); } A6 && operator[] (boost::arg<6> (*) ()) const { return std::forward( a6_ ); } A7 && operator[] (boost::arg<7> (*) ()) const { return std::forward( a7_ ); } template T & operator[] ( _bi::value & v ) const { return v.get(); } template T const & operator[] ( _bi::value const & v ) const { return v.get(); } template T & operator[] (reference_wrapper const & v) const { return v.get(); } template typename result_traits::type operator[] (bind_t & b) const { rrlist7 a( a1_, a2_, a3_, a4_, a5_, a6_, a7_ ); return b.eval( a ); } template typename result_traits::type operator[] (bind_t const & b) const { rrlist7 a( a1_, a2_, a3_, a4_, a5_, a6_, a7_ ); return b.eval( a ); } }; template< class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8 > class rrlist8 { private: A1 & a1_; A2 & a2_; A3 & a3_; A4 & a4_; A5 & a5_; A6 & a6_; A7 & a7_; A8 & a8_; public: rrlist8( A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8 ): a1_( a1 ), a2_( a2 ), a3_( a3 ), a4_( a4 ), a5_( a5 ), a6_( a6 ), a7_( a7 ), a8_( a8 ) {} A1 && operator[] (boost::arg<1>) const { return std::forward( a1_ ); } A2 && operator[] (boost::arg<2>) const { return std::forward( a2_ ); } A3 && operator[] (boost::arg<3>) const { return std::forward( a3_ ); } A4 && operator[] (boost::arg<4>) const { return std::forward( a4_ ); } A5 && operator[] (boost::arg<5>) const { return std::forward( a5_ ); } A6 && operator[] (boost::arg<6>) const { return std::forward( a6_ ); } A7 && operator[] (boost::arg<7>) const { return std::forward( a7_ ); } A8 && operator[] (boost::arg<8>) const { return std::forward( a8_ ); } A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward( a1_ ); } A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward( a2_ ); } A3 && operator[] (boost::arg<3> (*) ()) const { return std::forward( a3_ ); } A4 && operator[] (boost::arg<4> (*) ()) const { return std::forward( a4_ ); } A5 && operator[] (boost::arg<5> (*) ()) const { return std::forward( a5_ ); } A6 && operator[] (boost::arg<6> (*) ()) const { return std::forward( a6_ ); } A7 && operator[] (boost::arg<7> (*) ()) const { return std::forward( a7_ ); } A8 && operator[] (boost::arg<8> (*) ()) const { return std::forward( a8_ ); } template T & operator[] ( _bi::value & v ) const { return v.get(); } template T const & operator[] ( _bi::value const & v ) const { return v.get(); } template T & operator[] (reference_wrapper const & v) const { return v.get(); } template typename result_traits::type operator[] (bind_t & b) const { rrlist8 a( a1_, a2_, a3_, a4_, a5_, a6_, a7_, a8_ ); return b.eval( a ); } template typename result_traits::type operator[] (bind_t const & b) const { rrlist8 a( a1_, a2_, a3_, a4_, a5_, a6_, a7_, a8_ ); return b.eval( a ); } }; template< class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9 > class rrlist9 { private: A1 & a1_; A2 & a2_; A3 & a3_; A4 & a4_; A5 & a5_; A6 & a6_; A7 & a7_; A8 & a8_; A9 & a9_; public: rrlist9( A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8, A9 & a9 ): a1_( a1 ), a2_( a2 ), a3_( a3 ), a4_( a4 ), a5_( a5 ), a6_( a6 ), a7_( a7 ), a8_( a8 ), a9_( a9 ) {} A1 && operator[] (boost::arg<1>) const { return std::forward( a1_ ); } A2 && operator[] (boost::arg<2>) const { return std::forward( a2_ ); } A3 && operator[] (boost::arg<3>) const { return std::forward( a3_ ); } A4 && operator[] (boost::arg<4>) const { return std::forward( a4_ ); } A5 && operator[] (boost::arg<5>) const { return std::forward( a5_ ); } A6 && operator[] (boost::arg<6>) const { return std::forward( a6_ ); } A7 && operator[] (boost::arg<7>) const { return std::forward( a7_ ); } A8 && operator[] (boost::arg<8>) const { return std::forward( a8_ ); } A9 && operator[] (boost::arg<9>) const { return std::forward( a9_ ); } A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward( a1_ ); } A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward( a2_ ); } A3 && operator[] (boost::arg<3> (*) ()) const { return std::forward( a3_ ); } A4 && operator[] (boost::arg<4> (*) ()) const { return std::forward( a4_ ); } A5 && operator[] (boost::arg<5> (*) ()) const { return std::forward( a5_ ); } A6 && operator[] (boost::arg<6> (*) ()) const { return std::forward( a6_ ); } A7 && operator[] (boost::arg<7> (*) ()) const { return std::forward( a7_ ); } A8 && operator[] (boost::arg<8> (*) ()) const { return std::forward( a8_ ); } A9 && operator[] (boost::arg<9> (*) ()) const { return std::forward( a9_ ); } template T & operator[] ( _bi::value & v ) const { return v.get(); } template T const & operator[] ( _bi::value const & v ) const { return v.get(); } template T & operator[] (reference_wrapper const & v) const { return v.get(); } template typename result_traits::type operator[] (bind_t & b) const { rrlist9 a( a1_, a2_, a3_, a4_, a5_, a6_, a7_, a8_, a9_ ); return b.eval( a ); } template typename result_traits::type operator[] (bind_t const & b) const { rrlist9 a( a1_, a2_, a3_, a4_, a5_, a6_, a7_, a8_, a9_ ); return b.eval( a ); } }; template class bind_t { private: F f_; L l_; public: typedef typename result_traits::type result_type; typedef bind_t this_type; bind_t( F f, L const & l ): f_( f ), l_( l ) {} // result_type operator()() { list0 a; return l_( type(), f_, a, 0 ); } result_type operator()() const { list0 a; return l_( type(), f_, a, 0 ); } template result_type operator()( A1 && a1 ) { rrlist1< A1 > a( a1 ); return l_( type(), f_, a, 0 ); } template result_type operator()( A1 && a1 ) const { rrlist1< A1 > a( a1 ); return l_(type(), f_, a, 0); } template result_type operator()( A1 && a1, A2 && a2 ) { rrlist2< A1, A2 > a( a1, a2 ); return l_( type(), f_, a, 0 ); } template result_type operator()( A1 && a1, A2 && a2 ) const { rrlist2< A1, A2 > a( a1, a2 ); return l_( type(), f_, a, 0 ); } template result_type operator()( A1 && a1, A2 && a2, A3 && a3 ) { rrlist3< A1, A2, A3 > a( a1, a2, a3 ); return l_( type(), f_, a, 0 ); } template result_type operator()( A1 && a1, A2 && a2, A3 && a3 ) const { rrlist3< A1, A2, A3 > a( a1, a2, a3 ); return l_( type(), f_, a, 0 ); } template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4 ) { rrlist4< A1, A2, A3, A4 > a( a1, a2, a3, a4 ); return l_( type(), f_, a, 0 ); } template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4 ) const { rrlist4< A1, A2, A3, A4 > a( a1, a2, a3, a4 ); return l_( type(), f_, a, 0 ); } template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5 ) { rrlist5< A1, A2, A3, A4, A5 > a( a1, a2, a3, a4, a5 ); return l_( type(), f_, a, 0 ); } template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5 ) const { rrlist5< A1, A2, A3, A4, A5 > a( a1, a2, a3, a4, a5 ); return l_( type(), f_, a, 0 ); } template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6 ) { rrlist6< A1, A2, A3, A4, A5, A6 > a( a1, a2, a3, a4, a5, a6 ); return l_( type(), f_, a, 0 ); } template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6 ) const { rrlist6< A1, A2, A3, A4, A5, A6 > a( a1, a2, a3, a4, a5, a6 ); return l_( type(), f_, a, 0 ); } template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7 ) { rrlist7< A1, A2, A3, A4, A5, A6, A7 > a( a1, a2, a3, a4, a5, a6, a7 ); return l_( type(), f_, a, 0 ); } template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7 ) const { rrlist7< A1, A2, A3, A4, A5, A6, A7 > a( a1, a2, a3, a4, a5, a6, a7 ); return l_( type(), f_, a, 0 ); } template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7, A8 && a8 ) { rrlist8< A1, A2, A3, A4, A5, A6, A7, A8 > a( a1, a2, a3, a4, a5, a6, a7, a8 ); return l_( type(), f_, a, 0 ); } template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7, A8 && a8 ) const { rrlist8< A1, A2, A3, A4, A5, A6, A7, A8 > a( a1, a2, a3, a4, a5, a6, a7, a8 ); return l_( type(), f_, a, 0 ); } template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7, A8 && a8, A9 && a9 ) { rrlist9< A1, A2, A3, A4, A5, A6, A7, A8, A9 > a( a1, a2, a3, a4, a5, a6, a7, a8, a9 ); return l_( type(), f_, a, 0 ); } template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7, A8 && a8, A9 && a9 ) const { rrlist9< A1, A2, A3, A4, A5, A6, A7, A8, A9 > a( a1, a2, a3, a4, a5, a6, a7, a8, a9 ); return l_( type(), f_, a, 0 ); } // template result_type eval( A & a ) { return l_( type(), f_, a, 0 ); } template result_type eval( A & a ) const { return l_( type(), f_, a, 0 ); } template void accept( V & v ) const { #if !defined( BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP ) && !defined( BOOST_BORLANDC ) using boost::visit_each; #endif BOOST_BIND_VISIT_EACH( v, f_, 0 ); l_.accept( v ); } bool compare( this_type const & rhs ) const { return ref_compare( f_, rhs.f_, 0 ) && l_ == rhs.l_; } }; #elif !defined( BOOST_NO_VOID_RETURNS ) template class bind_t { public: typedef bind_t this_type; bind_t(F f, L const & l): f_(f), l_(l) {} #define BOOST_BIND_RETURN return #include #undef BOOST_BIND_RETURN }; #else // no void returns template struct bind_t_generator { template class implementation { public: typedef implementation this_type; implementation(F f, L const & l): f_(f), l_(l) {} #define BOOST_BIND_RETURN return #include #undef BOOST_BIND_RETURN }; }; template<> struct bind_t_generator { template class implementation { private: typedef void R; public: typedef implementation this_type; implementation(F f, L const & l): f_(f), l_(l) {} #define BOOST_BIND_RETURN #include #undef BOOST_BIND_RETURN }; }; template class bind_t: public bind_t_generator::BOOST_NESTED_TEMPLATE implementation { public: bind_t(F f, L const & l): bind_t_generator::BOOST_NESTED_TEMPLATE implementation(f, l) {} }; #endif // function_equal #ifndef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP // put overloads in _bi, rely on ADL # ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING template bool function_equal( bind_t const & a, bind_t const & b ) { return a.compare(b); } # else template bool function_equal_impl( bind_t const & a, bind_t const & b, int ) { return a.compare(b); } # endif // #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING #else // BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP // put overloads in boost } // namespace _bi # ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING template bool function_equal( _bi::bind_t const & a, _bi::bind_t const & b ) { return a.compare(b); } # else template bool function_equal_impl( _bi::bind_t const & a, _bi::bind_t const & b, int ) { return a.compare(b); } # endif // #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING namespace _bi { #endif // BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP // add_value #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) || (__SUNPRO_CC >= 0x530) #if defined( BOOST_BORLANDC ) && BOOST_WORKAROUND( BOOST_BORLANDC, BOOST_TESTED_AT(0x582) ) template struct add_value { typedef _bi::value type; }; #else template< class T, int I > struct add_value_2 { typedef boost::arg type; }; template< class T > struct add_value_2< T, 0 > { typedef _bi::value< T > type; }; template struct add_value { typedef typename add_value_2< T, boost::is_placeholder< T >::value >::type type; }; #endif template struct add_value< value > { typedef _bi::value type; }; template struct add_value< reference_wrapper > { typedef reference_wrapper type; }; template struct add_value< arg > { typedef boost::arg type; }; template struct add_value< arg (*) () > { typedef boost::arg (*type) (); }; template struct add_value< bind_t > { typedef bind_t type; }; #else template struct _avt_0; template<> struct _avt_0<1> { template struct inner { typedef T type; }; }; template<> struct _avt_0<2> { template struct inner { typedef value type; }; }; typedef char (&_avt_r1) [1]; typedef char (&_avt_r2) [2]; template _avt_r1 _avt_f(value); template _avt_r1 _avt_f(reference_wrapper); template _avt_r1 _avt_f(arg); template _avt_r1 _avt_f(arg (*) ()); template _avt_r1 _avt_f(bind_t); _avt_r2 _avt_f(...); template struct add_value { static T t(); typedef typename _avt_0::template inner::type type; }; #endif // list_av_N template struct list_av_1 { typedef typename add_value::type B1; typedef list1 type; }; template struct list_av_2 { typedef typename add_value::type B1; typedef typename add_value::type B2; typedef list2 type; }; template struct list_av_3 { typedef typename add_value::type B1; typedef typename add_value::type B2; typedef typename add_value::type B3; typedef list3 type; }; template struct list_av_4 { typedef typename add_value::type B1; typedef typename add_value::type B2; typedef typename add_value::type B3; typedef typename add_value::type B4; typedef list4 type; }; template struct list_av_5 { typedef typename add_value::type B1; typedef typename add_value::type B2; typedef typename add_value::type B3; typedef typename add_value::type B4; typedef typename add_value::type B5; typedef list5 type; }; template struct list_av_6 { typedef typename add_value::type B1; typedef typename add_value::type B2; typedef typename add_value::type B3; typedef typename add_value::type B4; typedef typename add_value::type B5; typedef typename add_value::type B6; typedef list6 type; }; template struct list_av_7 { typedef typename add_value::type B1; typedef typename add_value::type B2; typedef typename add_value::type B3; typedef typename add_value::type B4; typedef typename add_value::type B5; typedef typename add_value::type B6; typedef typename add_value::type B7; typedef list7 type; }; template struct list_av_8 { typedef typename add_value::type B1; typedef typename add_value::type B2; typedef typename add_value::type B3; typedef typename add_value::type B4; typedef typename add_value::type B5; typedef typename add_value::type B6; typedef typename add_value::type B7; typedef typename add_value::type B8; typedef list8 type; }; template struct list_av_9 { typedef typename add_value::type B1; typedef typename add_value::type B2; typedef typename add_value::type B3; typedef typename add_value::type B4; typedef typename add_value::type B5; typedef typename add_value::type B6; typedef typename add_value::type B7; typedef typename add_value::type B8; typedef typename add_value::type B9; typedef list9 type; }; // operator! struct logical_not { template bool operator()(V const & v) const { return !v; } }; template bind_t< bool, logical_not, list1< bind_t > > operator! (bind_t const & f) { typedef list1< bind_t > list_type; return bind_t ( logical_not(), list_type(f) ); } // relational operators #define BOOST_BIND_OPERATOR( op, name ) \ \ struct name \ { \ template bool operator()(V const & v, W const & w) const { return v op w; } \ }; \ \ template \ bind_t< bool, name, list2< bind_t, typename add_value::type > > \ operator op (bind_t const & f, A2 a2) \ { \ typedef typename add_value::type B2; \ typedef list2< bind_t, B2> list_type; \ return bind_t ( name(), list_type(f, a2) ); \ } BOOST_BIND_OPERATOR( ==, equal ) BOOST_BIND_OPERATOR( !=, not_equal ) BOOST_BIND_OPERATOR( <, less ) BOOST_BIND_OPERATOR( <=, less_equal ) BOOST_BIND_OPERATOR( >, greater ) BOOST_BIND_OPERATOR( >=, greater_equal ) BOOST_BIND_OPERATOR( &&, logical_and ) BOOST_BIND_OPERATOR( ||, logical_or ) #undef BOOST_BIND_OPERATOR #if defined(__GNUC__) && BOOST_WORKAROUND(__GNUC__, < 3) // resolve ambiguity with rel_ops #define BOOST_BIND_OPERATOR( op, name ) \ \ template \ bind_t< bool, name, list2< bind_t, bind_t > > \ operator op (bind_t const & f, bind_t const & g) \ { \ typedef list2< bind_t, bind_t > list_type; \ return bind_t ( name(), list_type(f, g) ); \ } BOOST_BIND_OPERATOR( !=, not_equal ) BOOST_BIND_OPERATOR( <=, less_equal ) BOOST_BIND_OPERATOR( >, greater ) BOOST_BIND_OPERATOR( >=, greater_equal ) #endif // visit_each, ADL #if !defined( BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP ) && !defined( BOOST_BORLANDC ) \ && !(defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ <= 3) template void visit_each( V & v, value const & t, int ) { using boost::visit_each; BOOST_BIND_VISIT_EACH( v, t.get(), 0 ); } template void visit_each( V & v, bind_t const & t, int ) { t.accept( v ); } #endif } // namespace _bi // visit_each, no ADL #if defined( BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP ) || defined( BOOST_BORLANDC ) \ || (defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ <= 3) template void visit_each( V & v, _bi::value const & t, int ) { BOOST_BIND_VISIT_EACH( v, t.get(), 0 ); } template void visit_each( V & v, _bi::bind_t const & t, int ) { t.accept( v ); } #endif // is_bind_expression template< class T > struct is_bind_expression { enum _vt { value = 0 }; }; #if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) template< class R, class F, class L > struct is_bind_expression< _bi::bind_t< R, F, L > > { enum _vt { value = 1 }; }; #endif // bind #ifndef BOOST_BIND #define BOOST_BIND bind #endif // generic function objects template _bi::bind_t BOOST_BIND(F f) { typedef _bi::list0 list_type; return _bi::bind_t (f, list_type()); } template _bi::bind_t::type> BOOST_BIND(F f, A1 a1) { typedef typename _bi::list_av_1::type list_type; return _bi::bind_t (f, list_type(a1)); } template _bi::bind_t::type> BOOST_BIND(F f, A1 a1, A2 a2) { typedef typename _bi::list_av_2::type list_type; return _bi::bind_t (f, list_type(a1, a2)); } template _bi::bind_t::type> BOOST_BIND(F f, A1 a1, A2 a2, A3 a3) { typedef typename _bi::list_av_3::type list_type; return _bi::bind_t(f, list_type(a1, a2, a3)); } template _bi::bind_t::type> BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4) { typedef typename _bi::list_av_4::type list_type; return _bi::bind_t(f, list_type(a1, a2, a3, a4)); } template _bi::bind_t::type> BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) { typedef typename _bi::list_av_5::type list_type; return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5)); } template _bi::bind_t::type> BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) { typedef typename _bi::list_av_6::type list_type; return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6)); } template _bi::bind_t::type> BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) { typedef typename _bi::list_av_7::type list_type; return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6, a7)); } template _bi::bind_t::type> BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) { typedef typename _bi::list_av_8::type list_type; return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8)); } template _bi::bind_t::type> BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) { typedef typename _bi::list_av_9::type list_type; return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); } // generic function objects, alternative syntax template _bi::bind_t BOOST_BIND(boost::type, F f) { typedef _bi::list0 list_type; return _bi::bind_t (f, list_type()); } template _bi::bind_t::type> BOOST_BIND(boost::type, F f, A1 a1) { typedef typename _bi::list_av_1::type list_type; return _bi::bind_t (f, list_type(a1)); } template _bi::bind_t::type> BOOST_BIND(boost::type, F f, A1 a1, A2 a2) { typedef typename _bi::list_av_2::type list_type; return _bi::bind_t (f, list_type(a1, a2)); } template _bi::bind_t::type> BOOST_BIND(boost::type, F f, A1 a1, A2 a2, A3 a3) { typedef typename _bi::list_av_3::type list_type; return _bi::bind_t(f, list_type(a1, a2, a3)); } template _bi::bind_t::type> BOOST_BIND(boost::type, F f, A1 a1, A2 a2, A3 a3, A4 a4) { typedef typename _bi::list_av_4::type list_type; return _bi::bind_t(f, list_type(a1, a2, a3, a4)); } template _bi::bind_t::type> BOOST_BIND(boost::type, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) { typedef typename _bi::list_av_5::type list_type; return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5)); } template _bi::bind_t::type> BOOST_BIND(boost::type, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) { typedef typename _bi::list_av_6::type list_type; return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6)); } template _bi::bind_t::type> BOOST_BIND(boost::type, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) { typedef typename _bi::list_av_7::type list_type; return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6, a7)); } template _bi::bind_t::type> BOOST_BIND(boost::type, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) { typedef typename _bi::list_av_8::type list_type; return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8)); } template _bi::bind_t::type> BOOST_BIND(boost::type, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) { typedef typename _bi::list_av_9::type list_type; return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); } #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) // adaptable function objects template _bi::bind_t<_bi::unspecified, F, _bi::list0> BOOST_BIND(F f) { typedef _bi::list0 list_type; return _bi::bind_t<_bi::unspecified, F, list_type> (f, list_type()); } template _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_1::type> BOOST_BIND(F f, A1 a1) { typedef typename _bi::list_av_1::type list_type; return _bi::bind_t<_bi::unspecified, F, list_type> (f, list_type(a1)); } template _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_2::type> BOOST_BIND(F f, A1 a1, A2 a2) { typedef typename _bi::list_av_2::type list_type; return _bi::bind_t<_bi::unspecified, F, list_type> (f, list_type(a1, a2)); } template _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_3::type> BOOST_BIND(F f, A1 a1, A2 a2, A3 a3) { typedef typename _bi::list_av_3::type list_type; return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3)); } template _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_4::type> BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4) { typedef typename _bi::list_av_4::type list_type; return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4)); } template _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_5::type> BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) { typedef typename _bi::list_av_5::type list_type; return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5)); } template _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_6::type> BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) { typedef typename _bi::list_av_6::type list_type; return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6)); } template _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_7::type> BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) { typedef typename _bi::list_av_7::type list_type; return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7)); } template _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_8::type> BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) { typedef typename _bi::list_av_8::type list_type; return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8)); } template _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_9::type> BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) { typedef typename _bi::list_av_9::type list_type; return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); } #endif // !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) // function pointers #define BOOST_BIND_CC #define BOOST_BIND_ST #define BOOST_BIND_NOEXCEPT #include # if defined( __cpp_noexcept_function_type ) || defined( _NOEXCEPT_TYPES_SUPPORTED ) # undef BOOST_BIND_NOEXCEPT # define BOOST_BIND_NOEXCEPT noexcept # include # endif #undef BOOST_BIND_CC #undef BOOST_BIND_ST #undef BOOST_BIND_NOEXCEPT #if defined(BOOST_BIND_ENABLE_STDCALL) && !defined(_M_X64) #define BOOST_BIND_CC __stdcall #define BOOST_BIND_ST #define BOOST_BIND_NOEXCEPT #include #undef BOOST_BIND_CC #undef BOOST_BIND_ST #undef BOOST_BIND_NOEXCEPT #endif #if defined(BOOST_BIND_ENABLE_FASTCALL) && !defined(_M_X64) #define BOOST_BIND_CC __fastcall #define BOOST_BIND_ST #define BOOST_BIND_NOEXCEPT #include #undef BOOST_BIND_CC #undef BOOST_BIND_ST #undef BOOST_BIND_NOEXCEPT #endif #ifdef BOOST_BIND_ENABLE_PASCAL #define BOOST_BIND_ST pascal #define BOOST_BIND_CC #define BOOST_BIND_NOEXCEPT #include #undef BOOST_BIND_ST #undef BOOST_BIND_CC #undef BOOST_BIND_NOEXCEPT #endif // member function pointers #define BOOST_BIND_MF_NAME(X) X #define BOOST_BIND_MF_CC #define BOOST_BIND_MF_NOEXCEPT #include #include # if defined( __cpp_noexcept_function_type ) || defined( _NOEXCEPT_TYPES_SUPPORTED ) # undef BOOST_BIND_MF_NOEXCEPT # define BOOST_BIND_MF_NOEXCEPT noexcept # include # include # endif #undef BOOST_BIND_MF_NAME #undef BOOST_BIND_MF_CC #undef BOOST_BIND_MF_NOEXCEPT #if defined(BOOST_MEM_FN_ENABLE_CDECL) && !defined(_M_X64) #define BOOST_BIND_MF_NAME(X) X##_cdecl #define BOOST_BIND_MF_CC __cdecl #define BOOST_BIND_MF_NOEXCEPT #include #include #undef BOOST_BIND_MF_NAME #undef BOOST_BIND_MF_CC #undef BOOST_BIND_MF_NOEXCEPT #endif #if defined(BOOST_MEM_FN_ENABLE_STDCALL) && !defined(_M_X64) #define BOOST_BIND_MF_NAME(X) X##_stdcall #define BOOST_BIND_MF_CC __stdcall #define BOOST_BIND_MF_NOEXCEPT #include #include #undef BOOST_BIND_MF_NAME #undef BOOST_BIND_MF_CC #undef BOOST_BIND_MF_NOEXCEPT #endif #if defined(BOOST_MEM_FN_ENABLE_FASTCALL) && !defined(_M_X64) #define BOOST_BIND_MF_NAME(X) X##_fastcall #define BOOST_BIND_MF_CC __fastcall #define BOOST_BIND_MF_NOEXCEPT #include #include #undef BOOST_BIND_MF_NAME #undef BOOST_BIND_MF_CC #undef BOOST_BIND_MF_NOEXCEPT #endif // data member pointers #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) || defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ || ( defined(BOOST_BORLANDC) && BOOST_WORKAROUND( BOOST_BORLANDC, BOOST_TESTED_AT( 0x620 ) ) ) template _bi::bind_t< R, _mfi::dm, typename _bi::list_av_1::type > BOOST_BIND(R T::*f, A1 a1) { typedef _mfi::dm F; typedef typename _bi::list_av_1::type list_type; return _bi::bind_t( F(f), list_type(a1) ); } #else namespace _bi { template< class Pm, int I > struct add_cref; template< class M, class T > struct add_cref< M T::*, 0 > { typedef M type; }; template< class M, class T > struct add_cref< M T::*, 1 > { #ifdef BOOST_MSVC #pragma warning(push) #pragma warning(disable:4180) #endif typedef M const & type; #ifdef BOOST_MSVC #pragma warning(pop) #endif }; template< class R, class T > struct add_cref< R (T::*) (), 1 > { typedef void type; }; #if !defined(__IBMCPP__) || __IBMCPP_FUNC_CV_TMPL_ARG_DEDUCTION template< class R, class T > struct add_cref< R (T::*) () const, 1 > { typedef void type; }; #if defined( __cpp_noexcept_function_type ) || defined( _NOEXCEPT_TYPES_SUPPORTED ) template< class R, class T > struct add_cref< R (T::*) () const noexcept, 1 > { typedef void type; }; #endif // __cpp_noexcept_function_type #endif // __IBMCPP__ template struct isref { enum value_type { value = 0 }; }; template struct isref< R& > { enum value_type { value = 1 }; }; template struct isref< R* > { enum value_type { value = 1 }; }; template struct dm_result { typedef typename add_cref< Pm, 1 >::type type; }; template struct dm_result< Pm, bind_t > { typedef typename bind_t::result_type result_type; typedef typename add_cref< Pm, isref< result_type >::value >::type type; }; } // namespace _bi template< class A1, class M, class T > _bi::bind_t< typename _bi::dm_result< M T::*, A1 >::type, _mfi::dm, typename _bi::list_av_1::type > BOOST_BIND( M T::*f, A1 a1 ) { typedef typename _bi::dm_result< M T::*, A1 >::type result_type; typedef _mfi::dm F; typedef typename _bi::list_av_1::type list_type; return _bi::bind_t< result_type, F, list_type >( F( f ), list_type( a1 ) ); } #endif } // namespace boost #ifndef BOOST_BIND_NO_PLACEHOLDERS # include #endif #ifdef BOOST_MSVC # pragma warning(default: 4512) // assignment operator could not be generated # pragma warning(pop) #endif #endif // #ifndef BOOST_BIND_BIND_HPP_INCLUDED