From 5cef4e4f788e763ad3a9bedcecc58ca3e0241eb8 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Thu, 4 Jan 2024 19:51:50 +0200 Subject: [PATCH] Eliminate mem_fn_template.hpp --- include/boost/bind/bind_mf2_cc.hpp | 108 +++------ include/boost/bind/bind_mf_cc.hpp | 324 ++++++++++--------------- include/boost/bind/mem_fn.hpp | 93 +++---- include/boost/bind/mem_fn_cc.hpp | 12 +- include/boost/bind/mem_fn_template.hpp | 119 --------- 5 files changed, 218 insertions(+), 438 deletions(-) delete mode 100644 include/boost/bind/mem_fn_template.hpp diff --git a/include/boost/bind/bind_mf2_cc.hpp b/include/boost/bind/bind_mf2_cc.hpp index 3a2c97aa..2b660704 100644 --- a/include/boost/bind/bind_mf2_cc.hpp +++ b/include/boost/bind/bind_mf2_cc.hpp @@ -17,22 +17,18 @@ template - _bi::bind_t, typename _bi::list_av_1::type> + auto BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) () BOOST_BIND_MF_NOEXCEPT, A1 a1) { - typedef _mfi::BOOST_BIND_MF_NAME(mf) F; - typedef typename _bi::list_av_1::type list_type; - return _bi::bind_t(F(f), list_type(a1)); + return boost::BOOST_BIND( boost::type(), boost::mem_fn( f ), a1 ); } template - _bi::bind_t, typename _bi::list_av_1::type> + auto BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) () const BOOST_BIND_MF_NOEXCEPT, A1 a1) { - typedef _mfi::BOOST_BIND_MF_NAME(cmf) F; - typedef typename _bi::list_av_1::type list_type; - return _bi::bind_t(F(f), list_type(a1)); + return boost::BOOST_BIND( boost::type(), boost::mem_fn( f ), a1 ); } // 1 @@ -40,23 +36,19 @@ template - _bi::bind_t, typename _bi::list_av_2::type> + auto BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2) { - typedef _mfi::BOOST_BIND_MF_NAME(mf) F; - typedef typename _bi::list_av_2::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2)); + return boost::BOOST_BIND( boost::type(), boost::mem_fn( f ), a1, a2 ); } template - _bi::bind_t, typename _bi::list_av_2::type> + auto BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2) { - typedef _mfi::BOOST_BIND_MF_NAME(cmf) F; - typedef typename _bi::list_av_2::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2)); + return boost::BOOST_BIND( boost::type(), boost::mem_fn( f ), a1, a2 ); } // 2 @@ -64,23 +56,19 @@ template - _bi::bind_t, typename _bi::list_av_3::type> + auto BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3) { - typedef _mfi::BOOST_BIND_MF_NAME(mf) F; - typedef typename _bi::list_av_3::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3)); + return boost::BOOST_BIND( boost::type(), boost::mem_fn( f ), a1, a2, a3 ); } template - _bi::bind_t, typename _bi::list_av_3::type> + auto BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3) { - typedef _mfi::BOOST_BIND_MF_NAME(cmf) F; - typedef typename _bi::list_av_3::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3)); + return boost::BOOST_BIND( boost::type(), boost::mem_fn( f ), a1, a2, a3 ); } // 3 @@ -88,23 +76,19 @@ template - _bi::bind_t, typename _bi::list_av_4::type> + auto BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4) { - typedef _mfi::BOOST_BIND_MF_NAME(mf) F; - typedef typename _bi::list_av_4::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4)); + return boost::BOOST_BIND( boost::type(), boost::mem_fn( f ), a1, a2, a3, a4 ); } template - _bi::bind_t, typename _bi::list_av_4::type> + auto BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4) { - typedef _mfi::BOOST_BIND_MF_NAME(cmf) F; - typedef typename _bi::list_av_4::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4)); + return boost::BOOST_BIND( boost::type(), boost::mem_fn( f ), a1, a2, a3, a4 ); } // 4 @@ -112,23 +96,19 @@ template - _bi::bind_t, typename _bi::list_av_5::type> + auto BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) { - typedef _mfi::BOOST_BIND_MF_NAME(mf) F; - typedef typename _bi::list_av_5::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5)); + return boost::BOOST_BIND( boost::type(), boost::mem_fn( f ), a1, a2, a3, a4, a5 ); } template - _bi::bind_t, typename _bi::list_av_5::type> + auto BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) { - typedef _mfi::BOOST_BIND_MF_NAME(cmf) F; - typedef typename _bi::list_av_5::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5)); + return boost::BOOST_BIND( boost::type(), boost::mem_fn( f ), a1, a2, a3, a4, a5 ); } // 5 @@ -136,23 +116,19 @@ template - _bi::bind_t, typename _bi::list_av_6::type> + auto BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) { - typedef _mfi::BOOST_BIND_MF_NAME(mf) F; - typedef typename _bi::list_av_6::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6)); + return boost::BOOST_BIND( boost::type(), boost::mem_fn( f ), a1, a2, a3, a4, a5, a6 ); } template - _bi::bind_t, typename _bi::list_av_6::type> + auto BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) { - typedef _mfi::BOOST_BIND_MF_NAME(cmf) F; - typedef typename _bi::list_av_6::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6)); + return boost::BOOST_BIND( boost::type(), boost::mem_fn( f ), a1, a2, a3, a4, a5, a6 ); } // 6 @@ -160,23 +136,19 @@ template - _bi::bind_t, typename _bi::list_av_7::type> + auto BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) { - typedef _mfi::BOOST_BIND_MF_NAME(mf) F; - typedef typename _bi::list_av_7::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7)); + return boost::BOOST_BIND( boost::type(), boost::mem_fn( f ), a1, a2, a3, a4, a5, a6, a7 ); } template - _bi::bind_t, typename _bi::list_av_7::type> + auto BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) { - typedef _mfi::BOOST_BIND_MF_NAME(cmf) F; - typedef typename _bi::list_av_7::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7)); + return boost::BOOST_BIND( boost::type(), boost::mem_fn( f ), a1, a2, a3, a4, a5, a6, a7 ); } // 7 @@ -184,23 +156,19 @@ template - _bi::bind_t, typename _bi::list_av_8::type> + auto BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) { - typedef _mfi::BOOST_BIND_MF_NAME(mf) F; - typedef typename _bi::list_av_8::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8)); + return boost::BOOST_BIND( boost::type(), boost::mem_fn( f ), a1, a2, a3, a4, a5, a6, a7, a8 ); } template - _bi::bind_t, typename _bi::list_av_8::type> + auto BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) { - typedef _mfi::BOOST_BIND_MF_NAME(cmf) F; - typedef typename _bi::list_av_8::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8)); + return boost::BOOST_BIND( boost::type(), boost::mem_fn( f ), a1, a2, a3, a4, a5, a6, a7, a8 ); } // 8 @@ -208,21 +176,17 @@ template - _bi::bind_t, typename _bi::list_av_9::type> + auto BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7, B8) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) { - typedef _mfi::BOOST_BIND_MF_NAME(mf) F; - typedef typename _bi::list_av_9::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); + return boost::BOOST_BIND( boost::type(), boost::mem_fn( f ), a1, a2, a3, a4, a5, a6, a7, a8, a9 ); } template - _bi::bind_t, typename _bi::list_av_9::type> + auto BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7, B8) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) { - typedef _mfi::BOOST_BIND_MF_NAME(cmf) F; - typedef typename _bi::list_av_9::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); + return boost::BOOST_BIND( boost::type(), boost::mem_fn( f ), a1, a2, a3, a4, a5, a6, a7, a8, a9 ); } diff --git a/include/boost/bind/bind_mf_cc.hpp b/include/boost/bind/bind_mf_cc.hpp index d98f9b61..00f24f40 100644 --- a/include/boost/bind/bind_mf_cc.hpp +++ b/include/boost/bind/bind_mf_cc.hpp @@ -16,44 +16,36 @@ template - _bi::bind_t, typename _bi::list_av_1::type> + auto BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) () BOOST_BIND_MF_NOEXCEPT, A1 a1) { - typedef _mfi::BOOST_BIND_MF_NAME(mf) F; - typedef typename _bi::list_av_1::type list_type; - return _bi::bind_t(F(f), list_type(a1)); + return boost::BOOST_BIND( boost::mem_fn( f ), a1 ); } template - _bi::bind_t, typename _bi::list_av_1::type> + auto BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) () const BOOST_BIND_MF_NOEXCEPT, A1 a1) { - typedef _mfi::BOOST_BIND_MF_NAME(cmf) F; - typedef typename _bi::list_av_1::type list_type; - return _bi::bind_t(F(f), list_type(a1)); + return boost::BOOST_BIND( boost::mem_fn( f ), a1 ); } template - typename boost::enable_if_c::value, - _bi::bind_t, typename _bi::list_av_1::type> - >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) () BOOST_BIND_MF_NOEXCEPT, A1 a1) + class A1, + class En = typename std::enable_if< !std::is_same::value >::type> + auto + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) () BOOST_BIND_MF_NOEXCEPT, A1 a1) { - typedef _mfi::BOOST_BIND_MF_NAME(mf) F; - typedef typename _bi::list_av_1::type list_type; - return _bi::bind_t(F(f), list_type(a1)); + return boost::BOOST_BIND( boost::mem_fn( f ), a1 ); } template - typename boost::enable_if_c::value, - _bi::bind_t, typename _bi::list_av_1::type> - >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) () const BOOST_BIND_MF_NOEXCEPT, A1 a1) + class A1, + class En = typename std::enable_if< !std::is_same::value >::type> + auto + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) () const BOOST_BIND_MF_NOEXCEPT, A1 a1) { - typedef _mfi::BOOST_BIND_MF_NAME(cmf) F; - typedef typename _bi::list_av_1::type list_type; - return _bi::bind_t(F(f), list_type(a1)); + return boost::BOOST_BIND( boost::mem_fn( f ), a1 ); } // 1 @@ -61,47 +53,39 @@ template - _bi::bind_t, typename _bi::list_av_2::type> + auto BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2) { - typedef _mfi::BOOST_BIND_MF_NAME(mf) F; - typedef typename _bi::list_av_2::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2)); + return boost::BOOST_BIND( boost::mem_fn( f ), a1, a2 ); } template - _bi::bind_t, typename _bi::list_av_2::type> + auto BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2) { - typedef _mfi::BOOST_BIND_MF_NAME(cmf) F; - typedef typename _bi::list_av_2::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2)); + return boost::BOOST_BIND( boost::mem_fn( f ), a1, a2 ); } template - typename boost::enable_if_c::value, - _bi::bind_t, typename _bi::list_av_2::type> - >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2) + class A1, class A2, + class En = typename std::enable_if< !std::is_same::value >::type> + auto + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2) { - typedef _mfi::BOOST_BIND_MF_NAME(mf) F; - typedef typename _bi::list_av_2::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2)); + return boost::BOOST_BIND( boost::mem_fn( f ), a1, a2 ); } template - typename boost::enable_if_c::value, - _bi::bind_t, typename _bi::list_av_2::type> - >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2) + class A1, class A2, + class En = typename std::enable_if< !std::is_same::value >::type> + auto + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2) { - typedef _mfi::BOOST_BIND_MF_NAME(cmf) F; - typedef typename _bi::list_av_2::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2)); + return boost::BOOST_BIND( boost::mem_fn( f ), a1, a2 ); } // 2 @@ -109,47 +93,39 @@ template - _bi::bind_t, typename _bi::list_av_3::type> + auto BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3) { - typedef _mfi::BOOST_BIND_MF_NAME(mf) F; - typedef typename _bi::list_av_3::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3)); + return boost::BOOST_BIND( boost::mem_fn( f ), a1, a2, a3 ); } template - _bi::bind_t, typename _bi::list_av_3::type> + auto BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3) { - typedef _mfi::BOOST_BIND_MF_NAME(cmf) F; - typedef typename _bi::list_av_3::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3)); + return boost::BOOST_BIND( boost::mem_fn( f ), a1, a2, a3 ); } template - typename boost::enable_if_c::value, - _bi::bind_t, typename _bi::list_av_3::type> - >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3) + class A1, class A2, class A3, + class En = typename std::enable_if< !std::is_same::value >::type> + auto + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3) { - typedef _mfi::BOOST_BIND_MF_NAME(mf) F; - typedef typename _bi::list_av_3::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3)); + return boost::BOOST_BIND( boost::mem_fn( f ), a1, a2, a3 ); } template - typename boost::enable_if_c::value, - _bi::bind_t, typename _bi::list_av_3::type> - >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3) + class A1, class A2, class A3, + class En = typename std::enable_if< !std::is_same::value >::type> + auto + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3) { - typedef _mfi::BOOST_BIND_MF_NAME(cmf) F; - typedef typename _bi::list_av_3::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3)); + return boost::BOOST_BIND( boost::mem_fn( f ), a1, a2, a3 ); } // 3 @@ -157,47 +133,39 @@ template - _bi::bind_t, typename _bi::list_av_4::type> + auto BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4) { - typedef _mfi::BOOST_BIND_MF_NAME(mf) F; - typedef typename _bi::list_av_4::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4)); + return boost::BOOST_BIND( boost::mem_fn( f ), a1, a2, a3, a4 ); } template - _bi::bind_t, typename _bi::list_av_4::type> + auto BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4) { - typedef _mfi::BOOST_BIND_MF_NAME(cmf) F; - typedef typename _bi::list_av_4::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4)); + return boost::BOOST_BIND( boost::mem_fn( f ), a1, a2, a3, a4 ); } template - typename boost::enable_if_c::value, - _bi::bind_t, typename _bi::list_av_4::type> - >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4) + class A1, class A2, class A3, class A4, + class En = typename std::enable_if< !std::is_same::value >::type> + auto + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4) { - typedef _mfi::BOOST_BIND_MF_NAME(mf) F; - typedef typename _bi::list_av_4::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4)); + return boost::BOOST_BIND( boost::mem_fn( f ), a1, a2, a3, a4 ); } template - typename boost::enable_if_c::value, - _bi::bind_t, typename _bi::list_av_4::type> - >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4) + class A1, class A2, class A3, class A4, + class En = typename std::enable_if< !std::is_same::value >::type> + auto + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4) { - typedef _mfi::BOOST_BIND_MF_NAME(cmf) F; - typedef typename _bi::list_av_4::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4)); + return boost::BOOST_BIND( boost::mem_fn( f ), a1, a2, a3, a4 ); } // 4 @@ -205,47 +173,39 @@ template - _bi::bind_t, typename _bi::list_av_5::type> + auto BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) { - typedef _mfi::BOOST_BIND_MF_NAME(mf) F; - typedef typename _bi::list_av_5::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5)); + return boost::BOOST_BIND( boost::mem_fn( f ), a1, a2, a3, a4, a5 ); } template - _bi::bind_t, typename _bi::list_av_5::type> + auto BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) { - typedef _mfi::BOOST_BIND_MF_NAME(cmf) F; - typedef typename _bi::list_av_5::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5)); + return boost::BOOST_BIND( boost::mem_fn( f ), a1, a2, a3, a4, a5 ); } template - typename boost::enable_if_c::value, - _bi::bind_t, typename _bi::list_av_5::type> - >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) + class A1, class A2, class A3, class A4, class A5, + class En = typename std::enable_if< !std::is_same::value >::type> + auto + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) { - typedef _mfi::BOOST_BIND_MF_NAME(mf) F; - typedef typename _bi::list_av_5::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5)); + return boost::BOOST_BIND( boost::mem_fn( f ), a1, a2, a3, a4, a5 ); } template - typename boost::enable_if_c::value, - _bi::bind_t, typename _bi::list_av_5::type> - >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) + class A1, class A2, class A3, class A4, class A5, + class En = typename std::enable_if< !std::is_same::value >::type> + auto + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) { - typedef _mfi::BOOST_BIND_MF_NAME(cmf) F; - typedef typename _bi::list_av_5::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5)); + return boost::BOOST_BIND( boost::mem_fn( f ), a1, a2, a3, a4, a5 ); } // 5 @@ -253,47 +213,39 @@ template - _bi::bind_t, typename _bi::list_av_6::type> + auto BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) { - typedef _mfi::BOOST_BIND_MF_NAME(mf) F; - typedef typename _bi::list_av_6::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6)); + return boost::BOOST_BIND( boost::mem_fn( f ), a1, a2, a3, a4, a5, a6 ); } template - _bi::bind_t, typename _bi::list_av_6::type> + auto BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) { - typedef _mfi::BOOST_BIND_MF_NAME(cmf) F; - typedef typename _bi::list_av_6::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6)); + return boost::BOOST_BIND( boost::mem_fn( f ), a1, a2, a3, a4, a5, a6 ); } template - typename boost::enable_if_c::value, - _bi::bind_t, typename _bi::list_av_6::type> - >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) + class A1, class A2, class A3, class A4, class A5, class A6, + class En = typename std::enable_if< !std::is_same::value >::type> + auto + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) { - typedef _mfi::BOOST_BIND_MF_NAME(mf) F; - typedef typename _bi::list_av_6::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6)); + return boost::BOOST_BIND( boost::mem_fn( f ), a1, a2, a3, a4, a5, a6 ); } template - typename boost::enable_if_c::value, - _bi::bind_t, typename _bi::list_av_6::type> - >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) + class A1, class A2, class A3, class A4, class A5, class A6, + class En = typename std::enable_if< !std::is_same::value >::type> + auto + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) { - typedef _mfi::BOOST_BIND_MF_NAME(cmf) F; - typedef typename _bi::list_av_6::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6)); + return boost::BOOST_BIND( boost::mem_fn( f ), a1, a2, a3, a4, a5, a6 ); } // 6 @@ -301,47 +253,39 @@ template - _bi::bind_t, typename _bi::list_av_7::type> + auto BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) { - typedef _mfi::BOOST_BIND_MF_NAME(mf) F; - typedef typename _bi::list_av_7::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7)); + return boost::BOOST_BIND( boost::mem_fn( f ), a1, a2, a3, a4, a5, a6, a7 ); } template - _bi::bind_t, typename _bi::list_av_7::type> + auto BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) { - typedef _mfi::BOOST_BIND_MF_NAME(cmf) F; - typedef typename _bi::list_av_7::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7)); + return boost::BOOST_BIND( boost::mem_fn( f ), a1, a2, a3, a4, a5, a6, a7 ); } template - typename boost::enable_if_c::value, - _bi::bind_t, typename _bi::list_av_7::type> - >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) + class A1, class A2, class A3, class A4, class A5, class A6, class A7, + class En = typename std::enable_if< !std::is_same::value >::type> + auto + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) { - typedef _mfi::BOOST_BIND_MF_NAME(mf) F; - typedef typename _bi::list_av_7::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7)); + return boost::BOOST_BIND( boost::mem_fn( f ), a1, a2, a3, a4, a5, a6, a7 ); } template - typename boost::enable_if_c::value, - _bi::bind_t, typename _bi::list_av_7::type> - >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) + class A1, class A2, class A3, class A4, class A5, class A6, class A7, + class En = typename std::enable_if< !std::is_same::value >::type> + auto + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) { - typedef _mfi::BOOST_BIND_MF_NAME(cmf) F; - typedef typename _bi::list_av_7::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7)); + return boost::BOOST_BIND( boost::mem_fn( f ), a1, a2, a3, a4, a5, a6, a7 ); } // 7 @@ -349,47 +293,39 @@ template - _bi::bind_t, typename _bi::list_av_8::type> + auto BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) { - typedef _mfi::BOOST_BIND_MF_NAME(mf) F; - typedef typename _bi::list_av_8::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8)); + return boost::BOOST_BIND( boost::mem_fn( f ), a1, a2, a3, a4, a5, a6, a7, a8 ); } template - _bi::bind_t, typename _bi::list_av_8::type> + auto BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) { - typedef _mfi::BOOST_BIND_MF_NAME(cmf) F; - typedef typename _bi::list_av_8::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8)); + return boost::BOOST_BIND( boost::mem_fn( f ), a1, a2, a3, a4, a5, a6, a7, a8 ); } template - typename boost::enable_if_c::value, - _bi::bind_t, typename _bi::list_av_8::type> - >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) + class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, + class En = typename std::enable_if< !std::is_same::value >::type> + auto + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) { - typedef _mfi::BOOST_BIND_MF_NAME(mf) F; - typedef typename _bi::list_av_8::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8)); + return boost::BOOST_BIND( boost::mem_fn( f ), a1, a2, a3, a4, a5, a6, a7, a8 ); } template - typename boost::enable_if_c::value, - _bi::bind_t, typename _bi::list_av_8::type> - >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) + class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, + class En = typename std::enable_if< !std::is_same::value >::type> + auto + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) { - typedef _mfi::BOOST_BIND_MF_NAME(cmf) F; - typedef typename _bi::list_av_8::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8)); + return boost::BOOST_BIND( boost::mem_fn( f ), a1, a2, a3, a4, a5, a6, a7, a8 ); } // 8 @@ -397,45 +333,37 @@ template - _bi::bind_t, typename _bi::list_av_9::type> + auto BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7, B8) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) { - typedef _mfi::BOOST_BIND_MF_NAME(mf) F; - typedef typename _bi::list_av_9::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); + return boost::BOOST_BIND( boost::mem_fn( f ), a1, a2, a3, a4, a5, a6, a7, a8, a9 ); } template - _bi::bind_t, typename _bi::list_av_9::type> + auto BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7, B8) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) { - typedef _mfi::BOOST_BIND_MF_NAME(cmf) F; - typedef typename _bi::list_av_9::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); + return boost::BOOST_BIND( boost::mem_fn( f ), a1, a2, a3, a4, a5, a6, a7, a8, a9 ); } template - typename boost::enable_if_c::value, - _bi::bind_t, typename _bi::list_av_9::type> - >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7, B8) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) + class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9, + class En = typename std::enable_if< !std::is_same::value >::type> + auto + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7, B8) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) { - typedef _mfi::BOOST_BIND_MF_NAME(mf) F; - typedef typename _bi::list_av_9::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); + return boost::BOOST_BIND( boost::mem_fn( f ), a1, a2, a3, a4, a5, a6, a7, a8, a9 ); } template - typename boost::enable_if_c::value, - _bi::bind_t, typename _bi::list_av_9::type> - >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7, B8) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) + class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9, + class En = typename std::enable_if< !std::is_same::value >::type> + auto + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7, B8) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) { - typedef _mfi::BOOST_BIND_MF_NAME(cmf) F; - typedef typename _bi::list_av_9::type list_type; - return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); + return boost::BOOST_BIND( boost::mem_fn( f ), a1, a2, a3, a4, a5, a6, a7, a8, a9 ); } diff --git a/include/boost/bind/mem_fn.hpp b/include/boost/bind/mem_fn.hpp index fa23f9b2..54266629 100644 --- a/include/boost/bind/mem_fn.hpp +++ b/include/boost/bind/mem_fn.hpp @@ -8,17 +8,16 @@ #endif // -// mem_fn.hpp - a generalization of std::mem_fun[_ref] +// mem_fn.hpp - a generalization of std::mem_fun[_ref] // -// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd. -// Copyright (c) 2001 David Abrahams -// Copyright (c) 2003-2005 Peter Dimov +// Copyright 2001-2005, 2024 Peter Dimov +// Copyright 2001 David Abrahams // // 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/mem_fn.html for documentation. +// See http://www.boost.org/libs/bind/mem_fn.html for documentation. // #include @@ -36,54 +35,55 @@ template struct remove_cvref: std::remove_cv< typename std::remove_refe { }; -} // namespace _mfi - -namespace _mfi +template class mf { +public: -#define BOOST_MEM_FN_NAME(X) X -#define BOOST_MEM_FN_CC - -#include - -#undef BOOST_MEM_FN_CC -#undef BOOST_MEM_FN_NAME - -#if defined(BOOST_MEM_FN_ENABLE_CDECL) && !defined(_M_X64) - -#define BOOST_MEM_FN_NAME(X) X##_cdecl -#define BOOST_MEM_FN_CC __cdecl - -#include - -#undef BOOST_MEM_FN_CC -#undef BOOST_MEM_FN_NAME - -#endif + typedef R result_type; -#if defined(BOOST_MEM_FN_ENABLE_STDCALL) && !defined(_M_X64) +private: -#define BOOST_MEM_FN_NAME(X) X##_stdcall -#define BOOST_MEM_FN_CC __stdcall + Pm pm_; -#include +public: -#undef BOOST_MEM_FN_CC -#undef BOOST_MEM_FN_NAME + mf( Pm pm ): pm_( pm ) {} -#endif + template::type, + class En = typename std::enable_if< + std::is_same::value || std::is_base_of::value + >::type + > -#if defined(BOOST_MEM_FN_ENABLE_FASTCALL) && !defined(_M_X64) + R operator()( U&& u, A... a ) const + { + return (std::forward( u ).*pm_)( std::forward( a )... ); + } -#define BOOST_MEM_FN_NAME(X) X##_fastcall -#define BOOST_MEM_FN_CC __fastcall + template::type, + class E1 = void, + class En = typename std::enable_if< + !(std::is_same::value || std::is_base_of::value) + >::type + > -#include + R operator()( U&& u, A... a ) const + { + return (get_pointer( std::forward( u ) )->*pm_)( std::forward( a )... ); + } -#undef BOOST_MEM_FN_CC -#undef BOOST_MEM_FN_NAME + bool operator==( mf const & rhs ) const + { + return pm_ == rhs.pm_; + } -#endif + bool operator!=( mf const & rhs ) const + { + return pm_ != rhs.pm_; + } +}; } // namespace _mfi @@ -160,13 +160,13 @@ template class dm typedef T const * argument_type; private: - + typedef R (T::*Pm); Pm pm_; public: - explicit dm( Pm pm ): pm_( pm ) {} + dm( Pm pm ): pm_( pm ) {} template::type, @@ -222,9 +222,12 @@ template class dm } // namespace _mfi -template _mfi::dm mem_fn(R T::*f) +template::value >::type +> +_mfi::dm mem_fn( R T::*pm ) { - return _mfi::dm(f); + return pm; } } // namespace boost diff --git a/include/boost/bind/mem_fn_cc.hpp b/include/boost/bind/mem_fn_cc.hpp index a1f006f9..58bdb4a7 100644 --- a/include/boost/bind/mem_fn_cc.hpp +++ b/include/boost/bind/mem_fn_cc.hpp @@ -12,12 +12,16 @@ // See http://www.boost.org/libs/bind/mem_fn.html for documentation. // -template _mfi::BOOST_MEM_FN_NAME(mf) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A...) BOOST_MEM_FN_NOEXCEPT) +template +_mfi::mf< R (BOOST_MEM_FN_CC T::*) (A...) BOOST_MEM_FN_NOEXCEPT, R, T, A... > +mem_fn( R (BOOST_MEM_FN_CC T::*pmf) (A...) BOOST_MEM_FN_NOEXCEPT ) { - return _mfi::BOOST_MEM_FN_NAME(mf)(f); + return pmf; } -template _mfi::BOOST_MEM_FN_NAME(cmf) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A...) const BOOST_MEM_FN_NOEXCEPT) +template +_mfi::mf< R (BOOST_MEM_FN_CC T::*) (A...) const BOOST_MEM_FN_NOEXCEPT, R, T, A... > +mem_fn( R (BOOST_MEM_FN_CC T::*pmf) (A...) const BOOST_MEM_FN_NOEXCEPT ) { - return _mfi::BOOST_MEM_FN_NAME(cmf)(f); + return pmf; } diff --git a/include/boost/bind/mem_fn_template.hpp b/include/boost/bind/mem_fn_template.hpp deleted file mode 100644 index db0eebed..00000000 --- a/include/boost/bind/mem_fn_template.hpp +++ /dev/null @@ -1,119 +0,0 @@ -// -// bind/mem_fn_template.hpp -// -// Do not include this header directly -// -// Copyright 2001, 2024 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/mem_fn.html for documentation. -// - -// mf - -template class BOOST_MEM_FN_NAME(mf) -{ -public: - - typedef R result_type; - -private: - - typedef R (BOOST_MEM_FN_CC T::*Pm) (A...); - Pm pm_; - -public: - - explicit BOOST_MEM_FN_NAME(mf)( Pm pm ): pm_( pm ) {} - - template::type, - class En = typename std::enable_if< - std::is_same::value || std::is_base_of::value - >::type - > - - R operator()( U&& u, A... a ) const - { - return (std::forward( u ).*pm_)( std::forward( a )... ); - } - - template::type, - class E1 = void, - class En = typename std::enable_if< - !(std::is_same::value || std::is_base_of::value) - >::type - > - - R operator()( U&& u, A... a ) const - { - return (get_pointer( std::forward( u ) )->*pm_)( std::forward( a )... ); - } - - bool operator==( BOOST_MEM_FN_NAME(mf) const & rhs ) const - { - return pm_ == rhs.pm_; - } - - bool operator!=( BOOST_MEM_FN_NAME(mf) const & rhs ) const - { - return pm_ != rhs.pm_; - } -}; - -// cmf - -template class BOOST_MEM_FN_NAME(cmf) -{ -public: - - typedef R result_type; - -private: - - typedef R (BOOST_MEM_FN_CC T::*Pm) (A...) const; - Pm pm_; - -public: - - explicit BOOST_MEM_FN_NAME(cmf)( Pm pm ): pm_( pm ) {} - - template::type, - class En = typename std::enable_if< - std::is_same::value || std::is_base_of::value - >::type - > - - R operator()( U&& u, A... a ) const - { - return (std::forward( u ).*pm_)( std::forward( a )... ); - } - - template::type, - class E1 = void, - class En = typename std::enable_if< - !(std::is_same::value || std::is_base_of::value) - >::type - > - - R operator()( U&& u, A... a ) const - { - return (get_pointer( std::forward( u ) )->*pm_)( std::forward( a )... ); - } - - bool operator==( BOOST_MEM_FN_NAME(cmf) const & rhs ) const - { - return pm_ == rhs.pm_; - } - - bool operator!=( BOOST_MEM_FN_NAME(cmf) const & rhs ) const - { - return pm_ != rhs.pm_; - } -};