Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:53:11

0001 
0002 //  (C) Copyright John Maddock 2005.  
0003 //  Use, modification and distribution are subject to the Boost Software License,
0004 //  Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0005 //  http://www.boost.org/LICENSE_1_0.txt).
0006 //
0007 //  See http://www.boost.org/libs/type_traits for most recent version including documentation.
0008 
0009 
0010 #ifndef BOOST_TT_IS_UNSIGNED_HPP_INCLUDED
0011 #define BOOST_TT_IS_UNSIGNED_HPP_INCLUDED
0012 
0013 #include <boost/type_traits/is_integral.hpp>
0014 #include <boost/type_traits/is_enum.hpp>
0015 #include <boost/type_traits/remove_cv.hpp>
0016 
0017 #include <climits>
0018 
0019 namespace boost {
0020 
0021 #if !defined( BOOST_CODEGEARC )
0022 
0023 #if !(defined(BOOST_MSVC) && BOOST_MSVC <= 1310) &&\
0024     !(defined(__EDG_VERSION__) && __EDG_VERSION__ <= 238) &&\
0025     !defined(BOOST_NO_INCLASS_MEMBER_INITIALIZATION)
0026 
0027 namespace detail{
0028 
0029 template <class T>
0030 struct is_unsigned_values
0031 {
0032    //
0033    // Note that we cannot use BOOST_STATIC_CONSTANT here, using enum's
0034    // rather than "real" static constants simply doesn't work or give
0035    // the correct answer.
0036    //
0037    typedef typename remove_cv<T>::type no_cv_t;
0038    static const no_cv_t minus_one = (static_cast<no_cv_t>(-1));
0039    static const no_cv_t zero = (static_cast<no_cv_t>(0));
0040 };
0041 
0042 template <class T>
0043 struct is_ununsigned_helper
0044 {
0045    BOOST_STATIC_CONSTANT(bool, value = (::boost::detail::is_unsigned_values<T>::minus_one > ::boost::detail::is_unsigned_values<T>::zero));
0046 };
0047 
0048 template <bool integral_type>
0049 struct is_unsigned_select_helper
0050 {
0051    template <class T>
0052    struct rebind
0053    {
0054       typedef is_ununsigned_helper<T> type;
0055    };
0056 };
0057 
0058 template <>
0059 struct is_unsigned_select_helper<false>
0060 {
0061    template <class T>
0062    struct rebind
0063    {
0064       typedef false_type type;
0065    };
0066 };
0067 
0068 template <class T>
0069 struct is_unsigned
0070 {
0071    typedef ::boost::detail::is_unsigned_select_helper< ::boost::is_integral<T>::value || ::boost::is_enum<T>::value > selector;
0072    typedef typename selector::template rebind<T> binder;
0073    typedef typename binder::type type;
0074    BOOST_STATIC_CONSTANT(bool, value = type::value);
0075 };
0076 
0077 } // namespace detail
0078 
0079 template <class T> struct is_unsigned : public integral_constant<bool, boost::detail::is_unsigned<T>::value> {};
0080 
0081 #else
0082 
0083 template <class T> struct is_unsigned : public false_type{};
0084 
0085 #endif
0086 
0087 #else // defined( BOOST_CODEGEARC )
0088 template <class T> struct is_unsigned : public integral_constant<bool, __is_unsigned(T)> {};
0089 #endif
0090 
0091 template <> struct is_unsigned<unsigned char> : public true_type{};
0092 template <> struct is_unsigned<const unsigned char> : public true_type{};
0093 template <> struct is_unsigned<volatile unsigned char> : public true_type{};
0094 template <> struct is_unsigned<const volatile unsigned char> : public true_type{};
0095 template <> struct is_unsigned<unsigned short> : public true_type{};
0096 template <> struct is_unsigned<const unsigned short> : public true_type{};
0097 template <> struct is_unsigned<volatile unsigned short> : public true_type{};
0098 template <> struct is_unsigned<const volatile unsigned short> : public true_type{};
0099 template <> struct is_unsigned<unsigned int> : public true_type{};
0100 template <> struct is_unsigned<const unsigned int> : public true_type{};
0101 template <> struct is_unsigned<volatile unsigned int> : public true_type{};
0102 template <> struct is_unsigned<const volatile unsigned int> : public true_type{};
0103 template <> struct is_unsigned<unsigned long> : public true_type{};
0104 template <> struct is_unsigned<const unsigned long> : public true_type{};
0105 template <> struct is_unsigned<volatile unsigned long> : public true_type{};
0106 template <> struct is_unsigned<const volatile unsigned long> : public true_type{};
0107 
0108 template <> struct is_unsigned<signed char> : public false_type{};
0109 template <> struct is_unsigned<const signed char> : public false_type{};
0110 template <> struct is_unsigned<volatile signed char> : public false_type{};
0111 template <> struct is_unsigned<const volatile signed char> : public false_type{};
0112 template <> struct is_unsigned< short> : public false_type{};
0113 template <> struct is_unsigned<const  short> : public false_type{};
0114 template <> struct is_unsigned<volatile  short> : public false_type{};
0115 template <> struct is_unsigned<const volatile  short> : public false_type{};
0116 template <> struct is_unsigned< int> : public false_type{};
0117 template <> struct is_unsigned<const  int> : public false_type{};
0118 template <> struct is_unsigned<volatile  int> : public false_type{};
0119 template <> struct is_unsigned<const volatile  int> : public false_type{};
0120 template <> struct is_unsigned< long> : public false_type{};
0121 template <> struct is_unsigned<const  long> : public false_type{};
0122 template <> struct is_unsigned<volatile  long> : public false_type{};
0123 template <> struct is_unsigned<const volatile  long> : public false_type{};
0124 #ifdef BOOST_HAS_LONG_LONG
0125 template <> struct is_unsigned< ::boost::ulong_long_type> : public true_type{};
0126 template <> struct is_unsigned<const ::boost::ulong_long_type> : public true_type{};
0127 template <> struct is_unsigned<volatile ::boost::ulong_long_type> : public true_type{};
0128 template <> struct is_unsigned<const volatile ::boost::ulong_long_type> : public true_type{};
0129 
0130 template <> struct is_unsigned< ::boost::long_long_type> : public false_type{};
0131 template <> struct is_unsigned<const ::boost::long_long_type> : public false_type{};
0132 template <> struct is_unsigned<volatile ::boost::long_long_type> : public false_type{};
0133 template <> struct is_unsigned<const volatile ::boost::long_long_type> : public false_type{};
0134 #endif
0135 #if defined(CHAR_MIN) 
0136 #if CHAR_MIN == 0
0137 template <> struct is_unsigned<char> : public true_type{};
0138 template <> struct is_unsigned<const char> : public true_type{};
0139 template <> struct is_unsigned<volatile char> : public true_type{};
0140 template <> struct is_unsigned<const volatile char> : public true_type{};
0141 #else
0142 template <> struct is_unsigned<char> : public false_type{};
0143 template <> struct is_unsigned<const char> : public false_type{};
0144 template <> struct is_unsigned<volatile char> : public false_type{};
0145 template <> struct is_unsigned<const volatile char> : public false_type{};
0146 #endif
0147 #endif
0148 #if !defined(BOOST_NO_INTRINSIC_WCHAR_T) && defined(WCHAR_MIN)
0149 #if WCHAR_MIN == 0
0150 template <> struct is_unsigned<wchar_t> : public true_type{};
0151 template <> struct is_unsigned<const wchar_t> : public true_type{};
0152 template <> struct is_unsigned<volatile wchar_t> : public true_type{};
0153 template <> struct is_unsigned<const volatile wchar_t> : public true_type{};
0154 #else
0155 template <> struct is_unsigned<wchar_t> : public false_type{};
0156 template <> struct is_unsigned<const wchar_t> : public false_type{};
0157 template <> struct is_unsigned<volatile wchar_t> : public false_type{};
0158 template <> struct is_unsigned<const volatile wchar_t> : public false_type{};
0159 #endif
0160 #endif
0161 } // namespace boost
0162 
0163 #endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED