forked from boostorg/function
Switch over to the new enable_if library
[SVN r21143]
This commit is contained in:
@ -23,6 +23,10 @@
|
|||||||
#include <boost/pending/ct_if.hpp>
|
#include <boost/pending/ct_if.hpp>
|
||||||
#include <boost/detail/workaround.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)
|
#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
|
# define BOOST_FUNCTION_TARGET_FIX(x) x
|
||||||
#else
|
#else
|
||||||
@ -38,35 +42,6 @@ namespace boost { namespace python { namespace objects {
|
|||||||
}}}
|
}}}
|
||||||
#endif
|
#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) \
|
#if defined (BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
|
||||||
|| defined(BOOST_BCB_PARTIAL_SPECIALIZATION_BUG) \
|
|| defined(BOOST_BCB_PARTIAL_SPECIALIZATION_BUG) \
|
||||||
|| !(BOOST_STRICT_CONFIG || !defined(__SUNPRO_CC) || __SUNPRO_CC > 0x540)
|
|| !(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
|
// A type that is only used for comparisons against zero
|
||||||
struct useless_clear_type {};
|
struct useless_clear_type {};
|
||||||
} // end namespace function
|
} // end namespace function
|
||||||
|
@ -276,12 +276,12 @@ namespace boost {
|
|||||||
// one with a default parameter.
|
// one with a default parameter.
|
||||||
template<typename Functor>
|
template<typename Functor>
|
||||||
BOOST_FUNCTION_FUNCTION(Functor BOOST_FUNCTION_TARGET_FIX(const &) f
|
BOOST_FUNCTION_FUNCTION(Functor BOOST_FUNCTION_TARGET_FIX(const &) f
|
||||||
#ifndef BOOST_FUNCTION_NO_ENABLE_IF
|
#ifndef BOOST_NO_SFINAE
|
||||||
,typename detail::function::enable_if<
|
,typename enable_if_c<
|
||||||
(::boost::type_traits::ice_not<
|
(::boost::type_traits::ice_not<
|
||||||
(is_integral<Functor>::value)>::value),
|
(is_integral<Functor>::value)>::value),
|
||||||
int>::type = 0
|
int>::type = 0
|
||||||
#endif // BOOST_FUNCTION_NO_ENABLE_IF
|
#endif // BOOST_NO_SFINAE
|
||||||
) :
|
) :
|
||||||
function_base(),
|
function_base(),
|
||||||
invoker(0)
|
invoker(0)
|
||||||
@ -289,7 +289,7 @@ namespace boost {
|
|||||||
this->assign_to(f);
|
this->assign_to(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef BOOST_FUNCTION_NO_ENABLE_IF
|
#ifndef BOOST_NO_SFINAE
|
||||||
BOOST_FUNCTION_FUNCTION(clear_type*) : function_base(), invoker(0) {}
|
BOOST_FUNCTION_FUNCTION(clear_type*) : function_base(), invoker(0) {}
|
||||||
#else
|
#else
|
||||||
BOOST_FUNCTION_FUNCTION(int zero) : function_base(), invoker(0)
|
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
|
// handle BOOST_FUNCTION_FUNCTION as the type of the temporary to
|
||||||
// construct.
|
// construct.
|
||||||
template<typename Functor>
|
template<typename Functor>
|
||||||
#ifndef BOOST_FUNCTION_NO_ENABLE_IF
|
#ifndef BOOST_NO_SFINAE
|
||||||
typename detail::function::enable_if<
|
typename enable_if_c<
|
||||||
(::boost::type_traits::ice_not<
|
(::boost::type_traits::ice_not<
|
||||||
(is_integral<Functor>::value)>::value),
|
(is_integral<Functor>::value)>::value),
|
||||||
BOOST_FUNCTION_FUNCTION&>::type
|
BOOST_FUNCTION_FUNCTION&>::type
|
||||||
@ -343,7 +343,7 @@ namespace boost {
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef BOOST_FUNCTION_NO_ENABLE_IF
|
#ifndef BOOST_NO_SFINAE
|
||||||
BOOST_FUNCTION_FUNCTION& operator=(clear_type*)
|
BOOST_FUNCTION_FUNCTION& operator=(clear_type*)
|
||||||
{
|
{
|
||||||
this->clear();
|
this->clear();
|
||||||
@ -584,8 +584,8 @@ public:
|
|||||||
|
|
||||||
template<typename Functor>
|
template<typename Functor>
|
||||||
function(Functor f
|
function(Functor f
|
||||||
#ifndef BOOST_FUNCTION_NO_ENABLE_IF
|
#ifndef BOOST_NO_SFINAE
|
||||||
,typename detail::function::enable_if<
|
,typename enable_if_c<
|
||||||
(::boost::type_traits::ice_not<
|
(::boost::type_traits::ice_not<
|
||||||
(is_integral<Functor>::value)>::value),
|
(is_integral<Functor>::value)>::value),
|
||||||
int>::type = 0
|
int>::type = 0
|
||||||
@ -595,7 +595,7 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef BOOST_FUNCTION_NO_ENABLE_IF
|
#ifndef BOOST_NO_SFINAE
|
||||||
function(clear_type*) : base_type() {}
|
function(clear_type*) : base_type() {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -610,8 +610,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename Functor>
|
template<typename Functor>
|
||||||
#ifndef BOOST_FUNCTION_NO_ENABLE_IF
|
#ifndef BOOST_NO_SFINAE
|
||||||
typename detail::function::enable_if<
|
typename enable_if_c<
|
||||||
(::boost::type_traits::ice_not<
|
(::boost::type_traits::ice_not<
|
||||||
(is_integral<Functor>::value)>::value),
|
(is_integral<Functor>::value)>::value),
|
||||||
self_type&>::type
|
self_type&>::type
|
||||||
@ -624,7 +624,7 @@ public:
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef BOOST_FUNCTION_NO_ENABLE_IF
|
#ifndef BOOST_NO_SFINAE
|
||||||
self_type& operator=(clear_type*)
|
self_type& operator=(clear_type*)
|
||||||
{
|
{
|
||||||
this->clear();
|
this->clear();
|
||||||
|
Reference in New Issue
Block a user