diff --git a/include/boost/function/function_base.hpp b/include/boost/function/function_base.hpp index 84da61a..ad7bb99 100644 --- a/include/boost/function/function_base.hpp +++ b/include/boost/function/function_base.hpp @@ -23,6 +23,10 @@ #include #include +#ifndef BOOST_NO_SFINAE +# include "boost/utility/enable_if.hpp" +#endif + #if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 || defined(__ICL) && __ICL <= 600 || defined(__MWERKS__) && __MWERKS__ < 0x2406 && !defined(BOOST_STRICT_CONFIG) # define BOOST_FUNCTION_TARGET_FIX(x) x #else @@ -38,35 +42,6 @@ namespace boost { namespace python { namespace objects { }}} #endif -// GCC 2.95.3 (or earlier) doesn't support enable_if -#if BOOST_WORKAROUND(__GNUC__, < 3) -# define BOOST_FUNCTION_NO_ENABLE_IF -#endif - -// MIPSpro 7.3.1.3m doesn't support enable_if -#if defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 730 && !defined(BOOST_STRICT_CONFIG) -# define BOOST_FUNCTION_NO_ENABLE_IF -#endif - -// MSVC 7.0 doesn't support enable_if -#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 && !defined(BOOST_STRICT_CONFIG) -# define BOOST_FUNCTION_NO_ENABLE_IF -#endif - -// Borland C++ 5.6.0 doesn't support enable_if -#if BOOST_WORKAROUND(__BORLANDC__, <= 0x564) -# define BOOST_FUNCTION_NO_ENABLE_IF -#endif - -// Metrowerks 8.3 doesn't support enable_if -#if BOOST_WORKAROUND(__MWERKS__, <= 0x3003) -# define BOOST_FUNCTION_NO_ENABLE_IF -#endif - -#if BOOST_WORKAROUND(__SUNPRO_CC, <= 0x540) -# define BOOST_FUNCTION_NO_ENABLE_IF -#endif - #if defined (BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ || defined(BOOST_BCB_PARTIAL_SPECIALIZATION_BUG) \ || !(BOOST_STRICT_CONFIG || !defined(__SUNPRO_CC) || __SUNPRO_CC > 0x540) @@ -294,36 +269,6 @@ namespace boost { } }; -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - template struct enable_if; - template struct enable_if { typedef T type; }; - template struct enable_if {}; - - template - struct enabled - { - template - struct base - { - typedef T type; - }; - }; - - template<> - struct enabled - { - template - struct base - { - }; - }; - - template - struct enable_if : public enabled::template base - { - }; -#endif - // A type that is only used for comparisons against zero struct useless_clear_type {}; } // end namespace function diff --git a/include/boost/function/function_template.hpp b/include/boost/function/function_template.hpp index 31367b3..9725dc5 100644 --- a/include/boost/function/function_template.hpp +++ b/include/boost/function/function_template.hpp @@ -276,12 +276,12 @@ namespace boost { // one with a default parameter. template BOOST_FUNCTION_FUNCTION(Functor BOOST_FUNCTION_TARGET_FIX(const &) f -#ifndef BOOST_FUNCTION_NO_ENABLE_IF - ,typename detail::function::enable_if< +#ifndef BOOST_NO_SFINAE + ,typename enable_if_c< (::boost::type_traits::ice_not< (is_integral::value)>::value), int>::type = 0 -#endif // BOOST_FUNCTION_NO_ENABLE_IF +#endif // BOOST_NO_SFINAE ) : function_base(), invoker(0) @@ -289,7 +289,7 @@ namespace boost { this->assign_to(f); } -#ifndef BOOST_FUNCTION_NO_ENABLE_IF +#ifndef BOOST_NO_SFINAE BOOST_FUNCTION_FUNCTION(clear_type*) : function_base(), invoker(0) {} #else BOOST_FUNCTION_FUNCTION(int zero) : function_base(), invoker(0) @@ -329,8 +329,8 @@ namespace boost { // handle BOOST_FUNCTION_FUNCTION as the type of the temporary to // construct. template -#ifndef BOOST_FUNCTION_NO_ENABLE_IF - typename detail::function::enable_if< +#ifndef BOOST_NO_SFINAE + typename enable_if_c< (::boost::type_traits::ice_not< (is_integral::value)>::value), BOOST_FUNCTION_FUNCTION&>::type @@ -343,7 +343,7 @@ namespace boost { return *this; } -#ifndef BOOST_FUNCTION_NO_ENABLE_IF +#ifndef BOOST_NO_SFINAE BOOST_FUNCTION_FUNCTION& operator=(clear_type*) { this->clear(); @@ -584,8 +584,8 @@ public: template function(Functor f -#ifndef BOOST_FUNCTION_NO_ENABLE_IF - ,typename detail::function::enable_if< +#ifndef BOOST_NO_SFINAE + ,typename enable_if_c< (::boost::type_traits::ice_not< (is_integral::value)>::value), int>::type = 0 @@ -595,7 +595,7 @@ public: { } -#ifndef BOOST_FUNCTION_NO_ENABLE_IF +#ifndef BOOST_NO_SFINAE function(clear_type*) : base_type() {} #endif @@ -610,8 +610,8 @@ public: } template -#ifndef BOOST_FUNCTION_NO_ENABLE_IF - typename detail::function::enable_if< +#ifndef BOOST_NO_SFINAE + typename enable_if_c< (::boost::type_traits::ice_not< (is_integral::value)>::value), self_type&>::type @@ -624,7 +624,7 @@ public: return *this; } -#ifndef BOOST_FUNCTION_NO_ENABLE_IF +#ifndef BOOST_NO_SFINAE self_type& operator=(clear_type*) { this->clear();