diff --git a/include/boost/function/function_base.hpp b/include/boost/function/function_base.hpp index c297847..98abc0f 100644 --- a/include/boost/function/function_base.hpp +++ b/include/boost/function/function_base.hpp @@ -522,65 +522,6 @@ namespace boost { // A type that is only used for comparisons against zero struct useless_clear_type {}; -#ifdef BOOST_NO_SFINAE - // These routines perform comparisons between a Boost.Function - // object and an arbitrary function object (when the last - // parameter is false_type) or against zero (when the - // last parameter is true_type). They are only necessary - // for compilers that don't support SFINAE. - template - bool - compare_equal(const Function& f, const Functor&, int, true_type) - { return f.empty(); } - - template - bool - compare_not_equal(const Function& f, const Functor&, int, - true_type) - { return !f.empty(); } - - template - bool - compare_equal(const Function& f, const Functor& g, long, - false_type) - { - if (const Functor* fp = f.template target()) - return function_equal(*fp, g); - else return false; - } - - template - bool - compare_equal(const Function& f, const reference_wrapper& g, - int, false_type) - { - if (const Functor* fp = f.template target()) - return fp == g.get_pointer(); - else return false; - } - - template - bool - compare_not_equal(const Function& f, const Functor& g, long, - false_type) - { - if (const Functor* fp = f.template target()) - return !function_equal(*fp, g); - else return true; - } - - template - bool - compare_not_equal(const Function& f, - const reference_wrapper& g, int, - false_type) - { - if (const Functor* fp = f.template target()) - return fp != g.get_pointer(); - else return true; - } -#endif // BOOST_NO_SFINAE - /** * Stores the "manager" portion of the vtable for a * boost::function object. @@ -705,7 +646,6 @@ public: # pragma clang diagnostic pop #endif -#ifndef BOOST_NO_SFINAE inline bool operator==(const function_base& f, detail::function::useless_clear_type*) { @@ -729,38 +669,6 @@ inline bool operator!=(detail::function::useless_clear_type*, { return !f.empty(); } -#endif - -#ifdef BOOST_NO_SFINAE -// Comparisons between boost::function objects and arbitrary function objects -template - inline bool operator==(const function_base& f, Functor g) - { - typedef integral_constant::value)> integral; - return detail::function::compare_equal(f, g, 0, integral()); - } - -template - inline bool operator==(Functor g, const function_base& f) - { - typedef integral_constant::value)> integral; - return detail::function::compare_equal(f, g, 0, integral()); - } - -template - inline bool operator!=(const function_base& f, Functor g) - { - typedef integral_constant::value)> integral; - return detail::function::compare_not_equal(f, g, 0, integral()); - } - -template - inline bool operator!=(Functor g, const function_base& f) - { - typedef integral_constant::value)> integral; - return detail::function::compare_not_equal(f, g, 0, integral()); - } -#else // Comparisons between boost::function objects and arbitrary function // objects. @@ -837,8 +745,6 @@ template else return true; } -#endif // Compiler supporting SFINAE - namespace detail { namespace function { inline bool has_empty_target(const function_base* f) diff --git a/include/boost/function/function_template.hpp b/include/boost/function/function_template.hpp index 006ca90..aed8b5f 100644 --- a/include/boost/function/function_template.hpp +++ b/include/boost/function/function_template.hpp @@ -698,11 +698,9 @@ namespace boost { // one with a default parameter. template BOOST_FUNCTION_FUNCTION(Functor f -#ifndef BOOST_NO_SFINAE ,typename boost::enable_if_< !(is_integral::value), int>::type = 0 -#endif // BOOST_NO_SFINAE ) : function_base() { @@ -710,25 +708,16 @@ namespace boost { } template BOOST_FUNCTION_FUNCTION(Functor f, Allocator a -#ifndef BOOST_NO_SFINAE ,typename boost::enable_if_< !(is_integral::value), int>::type = 0 -#endif // BOOST_NO_SFINAE ) : function_base() { this->assign_to_a(f,a); } -#ifndef BOOST_NO_SFINAE BOOST_FUNCTION_FUNCTION(clear_type*) : function_base() { } -#else - BOOST_FUNCTION_FUNCTION(int zero) : function_base() - { - BOOST_ASSERT(zero == 0); - } -#endif BOOST_FUNCTION_FUNCTION(const BOOST_FUNCTION_FUNCTION& f) : function_base() { @@ -759,13 +748,9 @@ namespace boost { // handle BOOST_FUNCTION_FUNCTION as the type of the temporary to // construct. template -#ifndef BOOST_NO_SFINAE typename boost::enable_if_< !(is_integral::value), BOOST_FUNCTION_FUNCTION&>::type -#else - BOOST_FUNCTION_FUNCTION& -#endif operator=(Functor f) { this->clear(); @@ -791,20 +776,11 @@ namespace boost { BOOST_CATCH_END } -#ifndef BOOST_NO_SFINAE BOOST_FUNCTION_FUNCTION& operator=(clear_type*) { this->clear(); return *this; } -#else - BOOST_FUNCTION_FUNCTION& operator=(int zero) - { - BOOST_ASSERT(zero == 0); - this->clear(); - return *this; - } -#endif // Assignment from another BOOST_FUNCTION_FUNCTION BOOST_FUNCTION_FUNCTION& operator=(const BOOST_FUNCTION_FUNCTION& f) @@ -1082,30 +1058,24 @@ public: template function(Functor f -#ifndef BOOST_NO_SFINAE ,typename boost::enable_if_< !(is_integral::value), int>::type = 0 -#endif ) : base_type(f) { } template function(Functor f, Allocator a -#ifndef BOOST_NO_SFINAE ,typename boost::enable_if_< !(is_integral::value), int>::type = 0 -#endif ) : base_type(f,a) { } -#ifndef BOOST_NO_SFINAE function(clear_type*) : base_type() {} -#endif function(const self_type& f) : base_type(static_cast(f)){} @@ -1132,26 +1102,20 @@ public: #endif template -#ifndef BOOST_NO_SFINAE typename boost::enable_if_< !(is_integral::value), self_type&>::type -#else - self_type& -#endif operator=(Functor f) { self_type(f).swap(*this); return *this; } -#ifndef BOOST_NO_SFINAE self_type& operator=(clear_type*) { this->clear(); return *this; } -#endif self_type& operator=(const base_type& f) {