Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/boost/bind/bind.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 #ifndef BOOST_BIND_BIND_HPP_INCLUDED
0002 #define BOOST_BIND_BIND_HPP_INCLUDED
0003 
0004 // MS compatible compilers support #pragma once
0005 
0006 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
0007 # pragma once
0008 #endif
0009 
0010 //
0011 // bind.hpp - binds function objects to arguments
0012 //
0013 // Copyright 2001-2005, 2024 Peter Dimov
0014 // Copyright 2001 David Abrahams
0015 //
0016 // Distributed under the Boost Software License, Version 1.0. (See
0017 // accompanying file LICENSE_1_0.txt or copy at
0018 // http://www.boost.org/LICENSE_1_0.txt)
0019 //
0020 //  See http://www.boost.org/libs/bind for documentation.
0021 //
0022 
0023 #include <boost/bind/mem_fn.hpp>
0024 #include <boost/bind/arg.hpp>
0025 #include <boost/bind/std_placeholders.hpp>
0026 #include <boost/bind/detail/result_traits.hpp>
0027 #include <boost/bind/detail/tuple_for_each.hpp>
0028 #include <boost/bind/detail/integer_sequence.hpp>
0029 #include <boost/visit_each.hpp>
0030 #include <boost/is_placeholder.hpp>
0031 #include <boost/type.hpp>
0032 #include <boost/core/ref.hpp>
0033 #include <boost/config.hpp>
0034 #include <boost/config/workaround.hpp>
0035 #include <utility>
0036 #include <type_traits>
0037 #include <tuple>
0038 
0039 #ifdef BOOST_MSVC
0040 # pragma warning(push)
0041 # pragma warning(disable: 4512) // assignment operator could not be generated
0042 #endif
0043 
0044 namespace boost
0045 {
0046 
0047 template<class T> class weak_ptr;
0048 
0049 namespace _bi // implementation details
0050 {
0051 
0052 // ref_compare
0053 
0054 template<class T> bool ref_compare( T const & a, T const & b )
0055 {
0056     return a == b;
0057 }
0058 
0059 template<int I> bool ref_compare( arg<I> const &, arg<I> const & )
0060 {
0061     return true;
0062 }
0063 
0064 template<int I> bool ref_compare( arg<I> (*) (), arg<I> (*) () )
0065 {
0066     return true;
0067 }
0068 
0069 template<class T> bool ref_compare( reference_wrapper<T> const & a, reference_wrapper<T> const & b )
0070 {
0071     return a.get_pointer() == b.get_pointer();
0072 }
0073 
0074 // bind_t forward declaration for listN
0075 
0076 template<class R, class F, class L> class bind_t;
0077 
0078 template<class R, class F, class L> bool ref_compare( bind_t<R, F, L> const & a, bind_t<R, F, L> const & b )
0079 {
0080     return a.compare( b );
0081 }
0082 
0083 // value
0084 
0085 template<class T> class value
0086 {
0087 public:
0088 
0089     value(T const & t): t_(t) {}
0090 
0091     T & get() { return t_; }
0092     T const & get() const { return t_; }
0093 
0094     bool operator==(value const & rhs) const
0095     {
0096         return t_ == rhs.t_;
0097     }
0098 
0099 private:
0100 
0101     T t_;
0102 };
0103 
0104 // ref_compare for weak_ptr
0105 
0106 template<class T> bool ref_compare( value< weak_ptr<T> > const & a, value< weak_ptr<T> > const & b )
0107 {
0108     return !(a.get() < b.get()) && !(b.get() < a.get());
0109 }
0110 
0111 // type
0112 
0113 template<class T> class type {};
0114 
0115 // unwrap
0116 
0117 template<class F> struct unwrapper
0118 {
0119     static inline F & unwrap( F & f, long )
0120     {
0121         return f;
0122     }
0123 
0124     template<class F2> static inline F2 & unwrap( reference_wrapper<F2> rf, int )
0125     {
0126         return rf.get();
0127     }
0128 
0129     template<class R, class T> static inline _mfi::dm<R, T> unwrap( R T::* pm, int )
0130     {
0131         return _mfi::dm<R, T>( pm );
0132     }
0133 };
0134 
0135 // list
0136 
0137 template<class V> struct accept_lambda
0138 {
0139     V& v_;
0140 
0141     explicit accept_lambda( V& v ): v_( v ) {}
0142 
0143     template<class A> void operator()( A& a ) const
0144     {
0145         visit_each( v_, a, 0 );
0146     }
0147 };
0148 
0149 struct equal_lambda
0150 {
0151     bool result;
0152 
0153     equal_lambda(): result( true ) {}
0154 
0155     template<class A1, class A2> void operator()( A1& a1, A2& a2 )
0156     {
0157         result = result && ref_compare( a1, a2 );
0158     }
0159 };
0160 
0161 struct logical_and;
0162 struct logical_or;
0163 
0164 template<class... A> class list
0165 {
0166 private:
0167 
0168     typedef std::tuple<A...> data_type;
0169     data_type data_;
0170 
0171 public:
0172 
0173     list( A... a ): data_( a... ) {}
0174 
0175 #if defined(BOOST_MSVC)
0176 # pragma warning( push )
0177 # pragma warning( disable: 4100 ) // unreferenced formal parameter 'a2'
0178 #endif
0179 
0180     template<class R, class F, class A2, std::size_t... I> R call_impl( type<R>, F & f, A2 & a2, _bi::index_sequence<I...> )
0181     {
0182         return unwrapper<F>::unwrap( f, 0 )( a2[ std::get<I>( data_ ) ]... );
0183     }
0184 
0185     template<class R, class F, class A2, std::size_t... I> R call_impl( type<R>, F & f, A2 & a2, _bi::index_sequence<I...> ) const
0186     {
0187         return unwrapper<F>::unwrap( f, 0 )( a2[ std::get<I>( data_ ) ]... );
0188     }
0189 
0190     template<class F, class A2, std::size_t... I> void call_impl( type<void>, F & f, A2 & a2, _bi::index_sequence<I...> )
0191     {
0192         unwrapper<F>::unwrap( f, 0 )( a2[ std::get<I>( data_ ) ]... );
0193     }
0194 
0195     template<class F, class A2, std::size_t... I> void call_impl( type<void>, F & f, A2 & a2, _bi::index_sequence<I...> ) const
0196     {
0197         unwrapper<F>::unwrap( f, 0 )( a2[ std::get<I>( data_ ) ]... );
0198     }
0199 
0200 #if defined(BOOST_MSVC)
0201 # pragma warning( pop )
0202 #endif
0203 
0204     //
0205 
0206     template<class R, class F, class A2> R operator()( type<R>, F & f, A2 & a2 )
0207     {
0208         return call_impl( type<R>(), f, a2, _bi::index_sequence_for<A...>() );
0209     }
0210 
0211     template<class R, class F, class A2> R operator()( type<R>, F & f, A2 & a2 ) const
0212     {
0213         return call_impl( type<R>(), f, a2, _bi::index_sequence_for<A...>() );
0214     }
0215 
0216     //
0217 
0218     template<class A2> bool operator()( type<bool>, logical_and & /*f*/, A2 & a2 )
0219     {
0220         static_assert( sizeof...(A) == 2, "operator&& must have two arguments" );
0221         return a2[ std::get<0>( data_ ) ] && a2[ std::get<1>( data_ ) ];
0222     }
0223 
0224     template<class A2> bool operator()( type<bool>, logical_and const & /*f*/, A2 & a2 ) const
0225     {
0226         static_assert( sizeof...(A) == 2, "operator&& must have two arguments" );
0227         return a2[ std::get<0>( data_ ) ] && a2[ std::get<1>( data_ ) ];
0228     }
0229 
0230     template<class A2> bool operator()( type<bool>, logical_or & /*f*/, A2 & a2 )
0231     {
0232         static_assert( sizeof...(A) == 2, "operator|| must have two arguments" );
0233         return a2[ std::get<0>( data_ ) ] || a2[ std::get<1>( data_ ) ];
0234     }
0235 
0236     template<class A2> bool operator()( type<bool>, logical_or const & /*f*/, A2 & a2 ) const
0237     {
0238         static_assert( sizeof...(A) == 2, "operator|| must have two arguments" );
0239         return a2[ std::get<0>( data_ ) ] || a2[ std::get<1>( data_ ) ];
0240     }
0241 
0242     //
0243 
0244     template<class V> void accept( V & v ) const
0245     {
0246         _bi::tuple_for_each( accept_lambda<V>( v ), data_ );
0247     }
0248 
0249     bool operator==( list const & rhs ) const
0250     {
0251         return _bi::tuple_for_each( equal_lambda(), data_, rhs.data_ ).result;
0252     }
0253 };
0254 
0255 // bind_t
0256 
0257 template<class... A> class rrlist
0258 {
0259 private:
0260 
0261     using args_type = std::tuple<A...>;
0262 
0263     using data_type = std::tuple<A&...>;
0264     data_type data_;
0265 
0266     template<class...> friend class rrlist;
0267 
0268 public:
0269 
0270     explicit rrlist( A&... a ): data_( a... ) {}
0271     template<class... B> explicit rrlist( rrlist<B...> const& r ): data_( r.data_ ) {}
0272 
0273     template<int I> typename std::tuple_element<I-1, args_type>::type&& operator[] ( boost::arg<I> ) const
0274     {
0275         return std::forward<typename std::tuple_element<I-1, args_type>::type>( std::get<I-1>( data_ ) );
0276     }
0277 
0278     template<int I> typename std::tuple_element<I-1, args_type>::type&& operator[] ( boost::arg<I>(*)() ) const
0279     {
0280         return std::forward<typename std::tuple_element<I-1, args_type>::type>( std::get<I-1>( data_ ) );
0281     }
0282 
0283     template<class T> T & operator[] ( _bi::value<T> & v ) const { return v.get(); }
0284 
0285     template<class T> T const & operator[] ( _bi::value<T> const & v ) const { return v.get(); }
0286 
0287     template<class T> T & operator[] ( reference_wrapper<T> const & v ) const { return v.get(); }
0288 
0289     template<class R, class F, class L> typename result_traits<R, F>::type operator[] ( bind_t<R, F, L> & b ) const
0290     {
0291         rrlist<A&...> a2( *this );
0292         return b.eval( a2 );
0293     }
0294 
0295     template<class R, class F, class L> typename result_traits<R, F>::type operator[] ( bind_t<R, F, L> const & b ) const
0296     {
0297         rrlist<A&...> a2( *this );
0298         return b.eval( a2 );
0299     }
0300 };
0301 
0302 template<class R, class F, class L> class bind_t
0303 {
0304 private:
0305 
0306     F f_;
0307     L l_;
0308 
0309 public:
0310 
0311     typedef typename result_traits<R, F>::type result_type;
0312     typedef bind_t this_type;
0313 
0314     bind_t( F f, L const & l ): f_( std::move(f) ), l_( l ) {}
0315 
0316     //
0317 
0318     template<class... A> result_type operator()( A&&... a )
0319     {
0320         rrlist<A...> a2( a... );
0321         return l_( type<result_type>(), f_, a2 );
0322     }
0323 
0324     template<class... A> result_type operator()( A&&... a ) const
0325     {
0326         rrlist<A...> a2( a... );
0327         return l_( type<result_type>(), f_, a2 );
0328     }
0329 
0330     //
0331 
0332     template<class A> result_type eval( A & a )
0333     {
0334         return l_( type<result_type>(), f_, a );
0335     }
0336 
0337     template<class A> result_type eval( A & a ) const
0338     {
0339         return l_( type<result_type>(), f_, a );
0340     }
0341 
0342     template<class V> void accept( V & v ) const
0343     {
0344         using boost::visit_each;
0345         visit_each( v, f_, 0 );
0346         l_.accept( v );
0347     }
0348 
0349     bool compare( this_type const & rhs ) const
0350     {
0351         return ref_compare( f_, rhs.f_ ) && l_ == rhs.l_;
0352     }
0353 };
0354 
0355 // function_equal
0356 
0357 template<class R, class F, class L> bool function_equal( bind_t<R, F, L> const & a, bind_t<R, F, L> const & b )
0358 {
0359     return a.compare(b);
0360 }
0361 
0362 // add_value
0363 
0364 template< class T, int I > struct add_value_2
0365 {
0366     typedef boost::arg<I> type;
0367 };
0368 
0369 template< class T > struct add_value_2< T, 0 >
0370 {
0371     typedef _bi::value< T > type;
0372 };
0373 
0374 template<class T> struct add_value
0375 {
0376     typedef typename add_value_2< T, boost::is_placeholder< T >::value >::type type;
0377 };
0378 
0379 template<class T> struct add_value< value<T> >
0380 {
0381     typedef _bi::value<T> type;
0382 };
0383 
0384 template<class T> struct add_value< reference_wrapper<T> >
0385 {
0386     typedef reference_wrapper<T> type;
0387 };
0388 
0389 template<int I> struct add_value< arg<I> >
0390 {
0391     typedef boost::arg<I> type;
0392 };
0393 
0394 template<int I> struct add_value< arg<I> (*) () >
0395 {
0396     typedef boost::arg<I> (*type) ();
0397 };
0398 
0399 template<class R, class F, class L> struct add_value< bind_t<R, F, L> >
0400 {
0401     typedef bind_t<R, F, L> type;
0402 };
0403 
0404 // list_av
0405 
0406 template<class... A> struct list_av
0407 {
0408     typedef list< typename add_value<A>::type... > type;
0409 };
0410 
0411 // operator!
0412 
0413 struct logical_not
0414 {
0415     template<class V> bool operator()(V const & v) const { return !v; }
0416 };
0417 
0418 template<class R, class F, class L>
0419     bind_t< bool, logical_not, list< bind_t<R, F, L> > >
0420     operator! (bind_t<R, F, L> const & f)
0421 {
0422     typedef list< bind_t<R, F, L> > list_type;
0423     return bind_t<bool, logical_not, list_type> ( logical_not(), list_type(f) );
0424 }
0425 
0426 // relational operators
0427 
0428 #define BOOST_BIND_OPERATOR( op, name ) \
0429 \
0430 struct name \
0431 { \
0432     template<class V, class W> bool operator()(V const & v, W const & w) const { return v op w; } \
0433 }; \
0434  \
0435 template<class R, class F, class L, class A2> \
0436     bind_t< bool, name, list< bind_t<R, F, L>, typename add_value<A2>::type > > \
0437     operator op (bind_t<R, F, L> const & f, A2 a2) \
0438 { \
0439     typedef typename add_value<A2>::type B2; \
0440     typedef list< bind_t<R, F, L>, B2> list_type; \
0441     return bind_t<bool, name, list_type> ( name(), list_type(f, a2) ); \
0442 }
0443 
0444 BOOST_BIND_OPERATOR( ==, equal )
0445 BOOST_BIND_OPERATOR( !=, not_equal )
0446 
0447 BOOST_BIND_OPERATOR( <, less )
0448 BOOST_BIND_OPERATOR( <=, less_equal )
0449 
0450 BOOST_BIND_OPERATOR( >, greater )
0451 BOOST_BIND_OPERATOR( >=, greater_equal )
0452 
0453 BOOST_BIND_OPERATOR( &&, logical_and )
0454 BOOST_BIND_OPERATOR( ||, logical_or )
0455 
0456 #undef BOOST_BIND_OPERATOR
0457 
0458 // visit_each
0459 
0460 template<class V, class T> void visit_each( V & v, value<T> const & t, int )
0461 {
0462     using boost::visit_each;
0463     visit_each( v, t.get(), 0 );
0464 }
0465 
0466 template<class V, class R, class F, class L> void visit_each( V & v, bind_t<R, F, L> const & t, int )
0467 {
0468     t.accept( v );
0469 }
0470 
0471 } // namespace _bi
0472 
0473 // is_bind_expression
0474 
0475 template< class T > struct is_bind_expression
0476 {
0477     enum _vt { value = 0 };
0478 };
0479 
0480 template< class R, class F, class L > struct is_bind_expression< _bi::bind_t< R, F, L > >
0481 {
0482     enum _vt { value = 1 };
0483 };
0484 
0485 // bind
0486 
0487 #ifndef BOOST_BIND
0488 #define BOOST_BIND bind
0489 #endif
0490 
0491 // generic function objects
0492 
0493 #if !BOOST_WORKAROUND(__GNUC__, < 6)
0494 
0495 template<class R, class F, class... A>
0496     _bi::bind_t<R, F, typename _bi::list_av<A...>::type>
0497     BOOST_BIND( F f, A... a )
0498 {
0499     typedef typename _bi::list_av<A...>::type list_type;
0500     return _bi::bind_t<R, F, list_type>( std::move(f), list_type( a... ) );
0501 }
0502 
0503 #else
0504 
0505 // g++ 4.x (and some 5.x) consider boost::bind<void>( &X::f )
0506 // ambiguous if the variadic form above is used
0507 
0508 template<class R, class F>
0509     _bi::bind_t<R, F, typename _bi::list_av<>::type>
0510     BOOST_BIND( F f )
0511 {
0512     typedef typename _bi::list_av<>::type list_type;
0513     return _bi::bind_t<R, F, list_type>( std::move(f), list_type() );
0514 }
0515 
0516 template<class R, class F, class A1>
0517     _bi::bind_t<R, F, typename _bi::list_av<A1>::type>
0518     BOOST_BIND( F f, A1 a1 )
0519 {
0520     typedef typename _bi::list_av<A1>::type list_type;
0521     return _bi::bind_t<R, F, list_type>( std::move(f), list_type( a1 ) );
0522 }
0523 
0524 template<class R, class F, class A1, class A2>
0525     _bi::bind_t<R, F, typename _bi::list_av<A1, A2>::type>
0526     BOOST_BIND( F f, A1 a1, A2 a2 )
0527 {
0528     typedef typename _bi::list_av<A1, A2>::type list_type;
0529     return _bi::bind_t<R, F, list_type>( std::move(f), list_type( a1, a2 ) );
0530 }
0531 
0532 template<class R, class F, class A1, class A2, class A3>
0533     _bi::bind_t<R, F, typename _bi::list_av<A1, A2, A3>::type>
0534     BOOST_BIND( F f, A1 a1, A2 a2, A3 a3 )
0535 {
0536     typedef typename _bi::list_av<A1, A2, A3>::type list_type;
0537     return _bi::bind_t<R, F, list_type>( std::move(f), list_type( a1, a2, a3 ) );
0538 }
0539 
0540 template<class R, class F, class A1, class A2, class A3, class A4>
0541     _bi::bind_t<R, F, typename _bi::list_av<A1, A2, A3, A4>::type>
0542     BOOST_BIND( F f, A1 a1, A2 a2, A3 a3, A4 a4 )
0543 {
0544     typedef typename _bi::list_av<A1, A2, A3, A4>::type list_type;
0545     return _bi::bind_t<R, F, list_type>( std::move(f), list_type( a1, a2, a3, a4 ) );
0546 }
0547 
0548 template<class R, class F, class A1, class A2, class A3, class A4, class A5>
0549     _bi::bind_t<R, F, typename _bi::list_av<A1, A2, A3, A4, A5>::type>
0550     BOOST_BIND( F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5 )
0551 {
0552     typedef typename _bi::list_av<A1, A2, A3, A4, A5>::type list_type;
0553     return _bi::bind_t<R, F, list_type>( std::move(f), list_type( a1, a2, a3, a4, a5 ) );
0554 }
0555 
0556 template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6>
0557     _bi::bind_t<R, F, typename _bi::list_av<A1, A2, A3, A4, A5, A6>::type>
0558     BOOST_BIND( F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6 )
0559 {
0560     typedef typename _bi::list_av<A1, A2, A3, A4, A5, A6>::type list_type;
0561     return _bi::bind_t<R, F, list_type>( std::move(f), list_type( a1, a2, a3, a4, a5, a6 ) );
0562 }
0563 
0564 template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7>
0565     _bi::bind_t<R, F, typename _bi::list_av<A1, A2, A3, A4, A5, A6, A7>::type>
0566     BOOST_BIND( F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7 )
0567 {
0568     typedef typename _bi::list_av<A1, A2, A3, A4, A5, A6, A7>::type list_type;
0569     return _bi::bind_t<R, F, list_type>( std::move(f), list_type( a1, a2, a3, a4, a5, a6, a7 ) );
0570 }
0571 
0572 template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
0573     _bi::bind_t<R, F, typename _bi::list_av<A1, A2, A3, A4, A5, A6, A7, A8>::type>
0574     BOOST_BIND( F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8 )
0575 {
0576     typedef typename _bi::list_av<A1, A2, A3, A4, A5, A6, A7, A8>::type list_type;
0577     return _bi::bind_t<R, F, list_type>( std::move(f), list_type( a1, a2, a3, a4, a5, a6, a7, a8 ) );
0578 }
0579 
0580 template<class R, class F, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9>
0581     _bi::bind_t<R, F, typename _bi::list_av<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type>
0582     BOOST_BIND( F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9 )
0583 {
0584     typedef typename _bi::list_av<A1, A2, A3, A4, A5, A6, A7, A8, A9>::type list_type;
0585     return _bi::bind_t<R, F, list_type>( std::move(f), list_type( a1, a2, a3, a4, a5, a6, a7, a8, a9 ) );
0586 }
0587 
0588 #endif
0589 
0590 // generic function objects, alternative syntax
0591 
0592 template<class R, class F, class... A>
0593     _bi::bind_t<R, F, typename _bi::list_av<A...>::type>
0594     BOOST_BIND( boost::type<R>, F f, A... a )
0595 {
0596     typedef typename _bi::list_av<A...>::type list_type;
0597     return _bi::bind_t<R, F, list_type>( std::move(f), list_type( a... ) );
0598 }
0599 
0600 // adaptable function objects
0601 
0602 template<class F, class... A>
0603     _bi::bind_t<_bi::unspecified, F, typename _bi::list_av<A...>::type>
0604     BOOST_BIND( F f, A... a )
0605 {
0606     typedef typename _bi::list_av<A...>::type list_type;
0607     return _bi::bind_t<_bi::unspecified, F, list_type>( std::move(f), list_type( a... ) );
0608 }
0609 
0610 // function pointers
0611 
0612 #define BOOST_BIND_CC
0613 #define BOOST_BIND_ST
0614 #define BOOST_BIND_NOEXCEPT
0615 
0616 #include <boost/bind/detail/bind_cc.hpp>
0617 
0618 # if defined( __cpp_noexcept_function_type ) || defined( _NOEXCEPT_TYPES_SUPPORTED )
0619 #   undef BOOST_BIND_NOEXCEPT
0620 #   define BOOST_BIND_NOEXCEPT noexcept
0621 #   include <boost/bind/detail/bind_cc.hpp>
0622 # endif
0623 
0624 #undef BOOST_BIND_CC
0625 #undef BOOST_BIND_ST
0626 #undef BOOST_BIND_NOEXCEPT
0627 
0628 #if defined(BOOST_BIND_ENABLE_STDCALL) && !defined(_M_X64)
0629 
0630 #define BOOST_BIND_CC __stdcall
0631 #define BOOST_BIND_ST
0632 #define BOOST_BIND_NOEXCEPT
0633 
0634 #include <boost/bind/detail/bind_cc.hpp>
0635 
0636 #undef BOOST_BIND_CC
0637 #undef BOOST_BIND_ST
0638 #undef BOOST_BIND_NOEXCEPT
0639 
0640 #endif
0641 
0642 #if defined(BOOST_BIND_ENABLE_FASTCALL) && !defined(_M_X64)
0643 
0644 #define BOOST_BIND_CC __fastcall
0645 #define BOOST_BIND_ST
0646 #define BOOST_BIND_NOEXCEPT
0647 
0648 #include <boost/bind/detail/bind_cc.hpp>
0649 
0650 #undef BOOST_BIND_CC
0651 #undef BOOST_BIND_ST
0652 #undef BOOST_BIND_NOEXCEPT
0653 
0654 #endif
0655 
0656 #ifdef BOOST_BIND_ENABLE_PASCAL
0657 
0658 #define BOOST_BIND_ST pascal
0659 #define BOOST_BIND_CC
0660 #define BOOST_BIND_NOEXCEPT
0661 
0662 #include <boost/bind/detail/bind_cc.hpp>
0663 
0664 #undef BOOST_BIND_ST
0665 #undef BOOST_BIND_CC
0666 #undef BOOST_BIND_NOEXCEPT
0667 
0668 #endif
0669 
0670 // member function pointers
0671 
0672 #define BOOST_BIND_MF_NAME(X) X
0673 #define BOOST_BIND_MF_CC
0674 #define BOOST_BIND_MF_NOEXCEPT
0675 
0676 #include <boost/bind/detail/bind_mf_cc.hpp>
0677 #include <boost/bind/detail/bind_mf2_cc.hpp>
0678 
0679 # if defined( __cpp_noexcept_function_type ) || defined( _NOEXCEPT_TYPES_SUPPORTED )
0680 #   undef BOOST_BIND_MF_NOEXCEPT
0681 #   define BOOST_BIND_MF_NOEXCEPT noexcept
0682 #   include <boost/bind/detail/bind_mf_cc.hpp>
0683 #   include <boost/bind/detail/bind_mf2_cc.hpp>
0684 # endif
0685 
0686 #undef BOOST_BIND_MF_NAME
0687 #undef BOOST_BIND_MF_CC
0688 #undef BOOST_BIND_MF_NOEXCEPT
0689 
0690 #if defined(BOOST_MEM_FN_ENABLE_CDECL) && !defined(_M_X64)
0691 
0692 #define BOOST_BIND_MF_NAME(X) X##_cdecl
0693 #define BOOST_BIND_MF_CC __cdecl
0694 #define BOOST_BIND_MF_NOEXCEPT
0695 
0696 #include <boost/bind/detail/bind_mf_cc.hpp>
0697 #include <boost/bind/detail/bind_mf2_cc.hpp>
0698 
0699 #undef BOOST_BIND_MF_NAME
0700 #undef BOOST_BIND_MF_CC
0701 #undef BOOST_BIND_MF_NOEXCEPT
0702 
0703 #endif
0704 
0705 #if defined(BOOST_MEM_FN_ENABLE_STDCALL) && !defined(_M_X64)
0706 
0707 #define BOOST_BIND_MF_NAME(X) X##_stdcall
0708 #define BOOST_BIND_MF_CC __stdcall
0709 #define BOOST_BIND_MF_NOEXCEPT
0710 
0711 #include <boost/bind/detail/bind_mf_cc.hpp>
0712 #include <boost/bind/detail/bind_mf2_cc.hpp>
0713 
0714 #undef BOOST_BIND_MF_NAME
0715 #undef BOOST_BIND_MF_CC
0716 #undef BOOST_BIND_MF_NOEXCEPT
0717 
0718 #endif
0719 
0720 #if defined(BOOST_MEM_FN_ENABLE_FASTCALL) && !defined(_M_X64)
0721 
0722 #define BOOST_BIND_MF_NAME(X) X##_fastcall
0723 #define BOOST_BIND_MF_CC __fastcall
0724 #define BOOST_BIND_MF_NOEXCEPT
0725 
0726 #include <boost/bind/detail/bind_mf_cc.hpp>
0727 #include <boost/bind/detail/bind_mf2_cc.hpp>
0728 
0729 #undef BOOST_BIND_MF_NAME
0730 #undef BOOST_BIND_MF_CC
0731 #undef BOOST_BIND_MF_NOEXCEPT
0732 
0733 #endif
0734 
0735 // data member pointers
0736 
0737 namespace _bi
0738 {
0739 
0740 template<class M, int I> struct add_cref;
0741 
0742 template<class M> struct add_cref<M, 0>
0743 {
0744     typedef M type;
0745 };
0746 
0747 template<class M> struct add_cref<M, 1>
0748 {
0749     typedef M const& type;
0750 };
0751 
0752 template<class R> struct isref
0753 {
0754     enum value_type { value = 0 };
0755 };
0756 
0757 template<class R> struct isref< R& >
0758 {
0759     enum value_type { value = 1 };
0760 };
0761 
0762 template<class R> struct isref< R* >
0763 {
0764     enum value_type { value = 1 };
0765 };
0766 
0767 template<class M, class A1, bool fn = std::is_function<M>::value> struct dm_result
0768 {
0769 };
0770 
0771 template<class M, class A1> struct dm_result<M, A1, false>
0772 {
0773     typedef typename add_cref< M, 1 >::type type;
0774 };
0775 
0776 template<class M, class R, class F, class L> struct dm_result<M, bind_t<R, F, L>, false>
0777 {
0778     typedef typename bind_t<R, F, L>::result_type result_type;
0779     typedef typename add_cref< M, isref< result_type >::value >::type type;
0780 };
0781 
0782 } // namespace _bi
0783 
0784 template<class A1, class M, class T>
0785 
0786 _bi::bind_t<
0787     typename _bi::dm_result<M, A1>::type,
0788     _mfi::dm<M, T>,
0789     typename _bi::list_av<A1>::type
0790 >
0791 
0792 BOOST_BIND( M T::*f, A1 a1 )
0793 {
0794     typedef typename _bi::dm_result<M, A1>::type result_type;
0795     typedef _mfi::dm<M, T> F;
0796     typedef typename _bi::list_av<A1>::type list_type;
0797     return _bi::bind_t< result_type, F, list_type >( F( f ), list_type( a1 ) );
0798 }
0799 
0800 } // namespace boost
0801 
0802 #ifndef BOOST_BIND_NO_PLACEHOLDERS
0803 
0804 # include <boost/bind/placeholders.hpp>
0805 
0806 #endif
0807 
0808 #ifdef BOOST_MSVC
0809 # pragma warning(default: 4512) // assignment operator could not be generated
0810 # pragma warning(pop)
0811 #endif
0812 
0813 #endif // #ifndef BOOST_BIND_BIND_HPP_INCLUDED