[857] | 1 |
|
---|
| 2 | // (C) Copyright John Maddock 2005.
|
---|
| 3 | // Use, modification and distribution are subject to the Boost Software License,
|
---|
| 4 | // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
---|
| 5 | // http://www.boost.org/LICENSE_1_0.txt).
|
---|
| 6 | //
|
---|
| 7 | // See http://www.boost.org/libs/type_traits for most recent version including documentation.
|
---|
| 8 |
|
---|
| 9 |
|
---|
| 10 | #ifndef BOOST_TT_IS_UNSIGNED_HPP_INCLUDED
|
---|
| 11 | #define BOOST_TT_IS_UNSIGNED_HPP_INCLUDED
|
---|
| 12 |
|
---|
| 13 | #include "boost/type_traits/is_integral.hpp"
|
---|
| 14 | #include "boost/type_traits/is_enum.hpp"
|
---|
| 15 | #include "boost/type_traits/detail/ice_or.hpp"
|
---|
| 16 |
|
---|
| 17 | // should be the last #include
|
---|
| 18 | #include "boost/type_traits/detail/bool_trait_def.hpp"
|
---|
| 19 |
|
---|
| 20 | namespace boost {
|
---|
| 21 |
|
---|
| 22 | namespace detail{
|
---|
| 23 |
|
---|
| 24 | #if !(defined(__EDG_VERSION__) && __EDG_VERSION__ <= 238)
|
---|
| 25 |
|
---|
| 26 | template <class T>
|
---|
| 27 | struct is_ununsigned_helper
|
---|
| 28 | {
|
---|
| 29 | BOOST_STATIC_CONSTANT(bool, value = (static_cast<T>(-1) > 0));
|
---|
| 30 | };
|
---|
| 31 |
|
---|
| 32 | template <bool integral_type>
|
---|
| 33 | struct is_ununsigned_select_helper
|
---|
| 34 | {
|
---|
| 35 | template <class T>
|
---|
| 36 | struct rebind
|
---|
| 37 | {
|
---|
| 38 | typedef is_ununsigned_helper<T> type;
|
---|
| 39 | };
|
---|
| 40 | };
|
---|
| 41 |
|
---|
| 42 | template <>
|
---|
| 43 | struct is_ununsigned_select_helper<false>
|
---|
| 44 | {
|
---|
| 45 | template <class T>
|
---|
| 46 | struct rebind
|
---|
| 47 | {
|
---|
| 48 | typedef false_type type;
|
---|
| 49 | };
|
---|
| 50 | };
|
---|
| 51 |
|
---|
| 52 | template <class T>
|
---|
| 53 | struct is_unsigned_imp
|
---|
| 54 | {
|
---|
| 55 | typedef is_ununsigned_select_helper<
|
---|
| 56 | ::boost::type_traits::ice_or<
|
---|
| 57 | ::boost::is_integral<T>::value,
|
---|
| 58 | ::boost::is_enum<T>::value>::value
|
---|
| 59 | > selector;
|
---|
| 60 | typedef typename selector::template rebind<T> binder;
|
---|
| 61 | typedef typename binder::type type;
|
---|
| 62 | BOOST_STATIC_CONSTANT(bool, value = type::value);
|
---|
| 63 | };
|
---|
| 64 |
|
---|
| 65 | #else
|
---|
| 66 |
|
---|
| 67 | template <class T> struct is_unsigned_imp : public false_type{};
|
---|
| 68 | template <> struct is_unsigned_imp<unsigned char> : public true_type{};
|
---|
| 69 | template <> struct is_unsigned_imp<const unsigned char> : public true_type{};
|
---|
| 70 | template <> struct is_unsigned_imp<volatile unsigned char> : public true_type{};
|
---|
| 71 | template <> struct is_unsigned_imp<const volatile unsigned char> : public true_type{};
|
---|
| 72 | template <> struct is_unsigned_imp<unsigned short> : public true_type{};
|
---|
| 73 | template <> struct is_unsigned_imp<const unsigned short> : public true_type{};
|
---|
| 74 | template <> struct is_unsigned_imp<volatile unsigned short> : public true_type{};
|
---|
| 75 | template <> struct is_unsigned_imp<const volatile unsigned short> : public true_type{};
|
---|
| 76 | template <> struct is_unsigned_imp<unsigned int> : public true_type{};
|
---|
| 77 | template <> struct is_unsigned_imp<const unsigned int> : public true_type{};
|
---|
| 78 | template <> struct is_unsigned_imp<volatile unsigned int> : public true_type{};
|
---|
| 79 | template <> struct is_unsigned_imp<const volatile unsigned int> : public true_type{};
|
---|
| 80 | template <> struct is_unsigned_imp<unsigned long> : public true_type{};
|
---|
| 81 | template <> struct is_unsigned_imp<const unsigned long> : public true_type{};
|
---|
| 82 | template <> struct is_unsigned_imp<volatile unsigned long> : public true_type{};
|
---|
| 83 | template <> struct is_unsigned_imp<const volatile unsigned long> : public true_type{};
|
---|
| 84 | #ifdef BOOST_HAS_LONG_LONG
|
---|
| 85 | template <> struct is_unsigned_imp<unsigned long long> : public true_type{};
|
---|
| 86 | template <> struct is_unsigned_imp<const unsigned long long> : public true_type{};
|
---|
| 87 | template <> struct is_unsigned_imp<volatile unsigned long long> : public true_type{};
|
---|
| 88 | template <> struct is_unsigned_imp<const volatile unsigned long long> : public true_type{};
|
---|
| 89 | #endif
|
---|
| 90 | #if defined(CHAR_MIN) && (CHAR_MIN == 0)
|
---|
| 91 | template <> struct is_unsigned_imp<char> : public true_type{};
|
---|
| 92 | template <> struct is_unsigned_imp<const char> : public true_type{};
|
---|
| 93 | template <> struct is_unsigned_imp<volatile char> : public true_type{};
|
---|
| 94 | template <> struct is_unsigned_imp<const volatile char> : public true_type{};
|
---|
| 95 | #endif
|
---|
| 96 | #if defined(WCHAR_MIN) && (WCHAR_MIN == 0)
|
---|
| 97 | template <> struct is_unsigned_imp<wchar_t> : public true_type{};
|
---|
| 98 | template <> struct is_unsigned_imp<const wchar_t> : public true_type{};
|
---|
| 99 | template <> struct is_unsigned_imp<volatile wchar_t> : public true_type{};
|
---|
| 100 | template <> struct is_unsigned_imp<const volatile wchar_t> : public true_type{};
|
---|
| 101 | #endif
|
---|
| 102 |
|
---|
| 103 | #endif
|
---|
| 104 |
|
---|
| 105 |
|
---|
| 106 | }
|
---|
| 107 |
|
---|
| 108 | BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_unsigned,T,::boost::detail::is_unsigned_imp<T>::value)
|
---|
| 109 |
|
---|
| 110 | } // namespace boost
|
---|
| 111 |
|
---|
| 112 | #include "boost/type_traits/detail/bool_trait_undef.hpp"
|
---|
| 113 |
|
---|
| 114 | #endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED
|
---|