Switch over to the new enable_if library

[SVN r21143]
This commit is contained in:
Douglas Gregor
2003-12-04 22:31:09 +00:00
parent 4bb90aae7a
commit 44e986afe3
2 changed files with 17 additions and 72 deletions

View File

@ -23,6 +23,10 @@
#include <boost/pending/ct_if.hpp>
#include <boost/detail/workaround.hpp>
#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<bool cond, typename T> struct enable_if;
template<typename T> struct enable_if<true, T> { typedef T type; };
template<typename T> struct enable_if<false, T> {};
template<bool x>
struct enabled
{
template<typename T>
struct base
{
typedef T type;
};
};
template<>
struct enabled<false>
{
template<typename T>
struct base
{
};
};
template<bool Enabled, typename T>
struct enable_if : public enabled<Enabled>::template base<T>
{
};
#endif
// A type that is only used for comparisons against zero
struct useless_clear_type {};
} // end namespace function

View File

@ -276,12 +276,12 @@ namespace boost {
// one with a default parameter.
template<typename Functor>
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<Functor>::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<typename Functor>
#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<Functor>::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<typename Functor>
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<Functor>::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<typename Functor>
#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<Functor>::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();