mirror of
https://github.com/boostorg/type_traits.git
synced 2025-08-02 05:54:31 +02:00
Fix for old and broken EDG compilers
[SVN r27055]
This commit is contained in:
@@ -21,6 +21,8 @@ namespace boost {
|
||||
|
||||
namespace detail{
|
||||
|
||||
#if (defined(__EDG_VERSION__) && __EDG_VERSION__ <= 238)
|
||||
|
||||
template <class T>
|
||||
struct is_signed_helper
|
||||
{
|
||||
@@ -64,6 +66,46 @@ struct is_signed_imp
|
||||
#endif
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
template <class T> struct is_signed_imp : public false_type{};
|
||||
template <> struct is_signed_imp<signed char> : public true_type{};
|
||||
template <> struct is_signed_imp<const signed char> : public true_type{};
|
||||
template <> struct is_signed_imp<volatile signed char> : public true_type{};
|
||||
template <> struct is_signed_imp<const volatile signed char> : public true_type{};
|
||||
template <> struct is_signed_imp<short> : public true_type{};
|
||||
template <> struct is_signed_imp<const short> : public true_type{};
|
||||
template <> struct is_signed_imp<volatile short> : public true_type{};
|
||||
template <> struct is_signed_imp<const volatile short> : public true_type{};
|
||||
template <> struct is_signed_imp<int> : public true_type{};
|
||||
template <> struct is_signed_imp<const int> : public true_type{};
|
||||
template <> struct is_signed_imp<volatile int> : public true_type{};
|
||||
template <> struct is_signed_imp<const volatile int> : public true_type{};
|
||||
template <> struct is_signed_imp<long> : public true_type{};
|
||||
template <> struct is_signed_imp<const long> : public true_type{};
|
||||
template <> struct is_signed_imp<volatile long> : public true_type{};
|
||||
template <> struct is_signed_imp<const volatile long> : public true_type{};
|
||||
#ifdef BOOST_HAS_LONG_LONG
|
||||
template <> struct is_signed_imp<long long> : public true_type{};
|
||||
template <> struct is_signed_imp<const long long> : public true_type{};
|
||||
template <> struct is_signed_imp<volatile long long> : public true_type{};
|
||||
template <> struct is_signed_imp<const volatile long long> : public true_type{};
|
||||
#endif
|
||||
#if defined(CHAR_MIN) && (CHAR_MIN != 0)
|
||||
template <> struct is_signed_imp<char> : public true_type{};
|
||||
template <> struct is_signed_imp<const char> : public true_type{};
|
||||
template <> struct is_signed_imp<volatile char> : public true_type{};
|
||||
template <> struct is_signed_imp<const volatile char> : public true_type{};
|
||||
#endif
|
||||
#if defined(WCHAR_MIN) && (WCHAR_MIN != 0)
|
||||
template <> struct is_signed_imp<wchar_t> : public true_type{};
|
||||
template <> struct is_signed_imp<const wchar_t> : public true_type{};
|
||||
template <> struct is_signed_imp<volatile wchar_t> : public true_type{};
|
||||
template <> struct is_signed_imp<const volatile wchar_t> : public true_type{};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_signed,T,::boost::detail::is_signed_imp<T>::value)
|
||||
|
@@ -21,24 +21,26 @@ namespace boost {
|
||||
|
||||
namespace detail{
|
||||
|
||||
#if !(defined(__EDG_VERSION__) && __EDG_VERSION__ <= 238)
|
||||
|
||||
template <class T>
|
||||
struct is_unsigned_helper
|
||||
struct is_ununsigned_helper
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value = (static_cast<T>(-1) > 0));
|
||||
};
|
||||
|
||||
template <bool integral_type>
|
||||
struct is_unsigned_select_helper
|
||||
struct is_ununsigned_select_helper
|
||||
{
|
||||
template <class T>
|
||||
struct rebind
|
||||
{
|
||||
typedef is_unsigned_helper<T> type;
|
||||
typedef is_ununsigned_helper<T> type;
|
||||
};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct is_unsigned_select_helper<false>
|
||||
struct is_ununsigned_select_helper<false>
|
||||
{
|
||||
template <class T>
|
||||
struct rebind
|
||||
@@ -50,7 +52,7 @@ struct is_unsigned_select_helper<false>
|
||||
template <class T>
|
||||
struct is_unsigned_imp
|
||||
{
|
||||
typedef is_unsigned_select_helper<
|
||||
typedef is_ununsigned_select_helper<
|
||||
::boost::type_traits::ice_or<
|
||||
::boost::is_integral<T>::value,
|
||||
::boost::is_enum<T>::value>::value
|
||||
@@ -60,6 +62,47 @@ struct is_unsigned_imp
|
||||
BOOST_STATIC_CONSTANT(bool, value = type::value);
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
template <class T> struct is_unsigned_imp : public false_type{};
|
||||
template <> struct is_unsigned_imp<unsigned char> : public true_type{};
|
||||
template <> struct is_unsigned_imp<const unsigned char> : public true_type{};
|
||||
template <> struct is_unsigned_imp<volatile unsigned char> : public true_type{};
|
||||
template <> struct is_unsigned_imp<const volatile unsigned char> : public true_type{};
|
||||
template <> struct is_unsigned_imp<unsigned short> : public true_type{};
|
||||
template <> struct is_unsigned_imp<const unsigned short> : public true_type{};
|
||||
template <> struct is_unsigned_imp<volatile unsigned short> : public true_type{};
|
||||
template <> struct is_unsigned_imp<const volatile unsigned short> : public true_type{};
|
||||
template <> struct is_unsigned_imp<unsigned int> : public true_type{};
|
||||
template <> struct is_unsigned_imp<const unsigned int> : public true_type{};
|
||||
template <> struct is_unsigned_imp<volatile unsigned int> : public true_type{};
|
||||
template <> struct is_unsigned_imp<const volatile unsigned int> : public true_type{};
|
||||
template <> struct is_unsigned_imp<unsigned long> : public true_type{};
|
||||
template <> struct is_unsigned_imp<const unsigned long> : public true_type{};
|
||||
template <> struct is_unsigned_imp<volatile unsigned long> : public true_type{};
|
||||
template <> struct is_unsigned_imp<const volatile unsigned long> : public true_type{};
|
||||
#ifdef BOOST_HAS_LONG_LONG
|
||||
template <> struct is_unsigned_imp<unsigned long long> : public true_type{};
|
||||
template <> struct is_unsigned_imp<const unsigned long long> : public true_type{};
|
||||
template <> struct is_unsigned_imp<volatile unsigned long long> : public true_type{};
|
||||
template <> struct is_unsigned_imp<const volatile unsigned long long> : public true_type{};
|
||||
#endif
|
||||
#if defined(CHAR_MIN) && (CHAR_MIN == 0)
|
||||
template <> struct is_unsigned_imp<char> : public true_type{};
|
||||
template <> struct is_unsigned_imp<const char> : public true_type{};
|
||||
template <> struct is_unsigned_imp<volatile char> : public true_type{};
|
||||
template <> struct is_unsigned_imp<const volatile char> : public true_type{};
|
||||
#endif
|
||||
#if defined(WCHAR_MIN) && (WCHAR_MIN == 0)
|
||||
template <> struct is_unsigned_imp<wchar_t> : public true_type{};
|
||||
template <> struct is_unsigned_imp<const wchar_t> : public true_type{};
|
||||
template <> struct is_unsigned_imp<volatile wchar_t> : public true_type{};
|
||||
template <> struct is_unsigned_imp<const volatile wchar_t> : public true_type{};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
|
||||
BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_unsigned,T,::boost::detail::is_unsigned_imp<T>::value)
|
||||
|
Reference in New Issue
Block a user