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_SIGNED_HPP_INCLUDED
0011 #define BOOST_TT_IS_SIGNED_HPP_INCLUDED
0012 
0013 #include <boost/type_traits/is_integral.hpp>
0014 #include <boost/type_traits/remove_cv.hpp>
0015 #include <boost/type_traits/is_enum.hpp>
0016 #include <climits>
0017 
0018 namespace boost {
0019 
0020 #if !defined( BOOST_CODEGEARC )
0021 
0022 #if !(defined(BOOST_MSVC) && BOOST_MSVC <= 1310) && \
0023     !(defined(__EDG_VERSION__) && __EDG_VERSION__ <= 238) &&\
0024     !defined(BOOST_NO_INCLASS_MEMBER_INITIALIZATION)
0025 
0026 namespace detail{
0027 
0028 template <class T>
0029 struct is_signed_values
0030 {
0031    //
0032    // Note that we cannot use BOOST_STATIC_CONSTANT here, using enum's
0033    // rather than "real" static constants simply doesn't work or give
0034    // the correct answer.
0035    //
0036    typedef typename remove_cv<T>::type no_cv_t;
0037    static const no_cv_t minus_one = (static_cast<no_cv_t>(-1));
0038    static const no_cv_t zero = (static_cast<no_cv_t>(0));
0039 };
0040 
0041 template <class T>
0042 struct is_signed_helper
0043 {
0044    typedef typename remove_cv<T>::type no_cv_t;
0045    BOOST_STATIC_CONSTANT(bool, value = (!(::boost::detail::is_signed_values<T>::minus_one  > boost::detail::is_signed_values<T>::zero)));
0046 };
0047 
0048 template <bool integral_type>
0049 struct is_signed_select_helper
0050 {
0051    template <class T>
0052    struct rebind
0053    {
0054       typedef is_signed_helper<T> type;
0055    };
0056 };
0057 
0058 template <>
0059 struct is_signed_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_signed_impl
0070 {
0071    typedef ::boost::detail::is_signed_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 }
0078 
0079 template <class T> struct is_signed : public integral_constant<bool, boost::detail::is_signed_impl<T>::value> {};
0080 
0081 #else
0082 
0083 template <class T> struct is_signed : public false_type{};
0084 
0085 #endif
0086 
0087 #else //defined( BOOST_CODEGEARC )
0088    template <class T> struct is_signed : public integral_constant<bool, __is_signed(T)>{};
0089 #endif
0090 
0091 template <> struct is_signed<signed char> : public true_type{};
0092 template <> struct is_signed<const signed char> : public true_type{};
0093 template <> struct is_signed<volatile signed char> : public true_type{};
0094 template <> struct is_signed<const volatile signed char> : public true_type{};
0095 template <> struct is_signed<short> : public true_type{};
0096 template <> struct is_signed<const short> : public true_type{};
0097 template <> struct is_signed<volatile short> : public true_type{};
0098 template <> struct is_signed<const volatile short> : public true_type{};
0099 template <> struct is_signed<int> : public true_type{};
0100 template <> struct is_signed<const int> : public true_type{};
0101 template <> struct is_signed<volatile int> : public true_type{};
0102 template <> struct is_signed<const volatile int> : public true_type{};
0103 template <> struct is_signed<long> : public true_type{};
0104 template <> struct is_signed<const long> : public true_type{};
0105 template <> struct is_signed<volatile long> : public true_type{};
0106 template <> struct is_signed<const volatile long> : public true_type{};
0107 
0108 template <> struct is_signed<unsigned char> : public false_type{};
0109 template <> struct is_signed<const unsigned char> : public false_type{};
0110 template <> struct is_signed<volatile unsigned char> : public false_type{};
0111 template <> struct is_signed<const volatile unsigned char> : public false_type{};
0112 template <> struct is_signed<unsigned short> : public false_type{};
0113 template <> struct is_signed<const unsigned short> : public false_type{};
0114 template <> struct is_signed<volatile unsigned short> : public false_type{};
0115 template <> struct is_signed<const volatile unsigned short> : public false_type{};
0116 template <> struct is_signed<unsigned int> : public false_type{};
0117 template <> struct is_signed<const unsigned int> : public false_type{};
0118 template <> struct is_signed<volatile unsigned int> : public false_type{};
0119 template <> struct is_signed<const volatile unsigned int> : public false_type{};
0120 template <> struct is_signed<unsigned long> : public false_type{};
0121 template <> struct is_signed<const unsigned long> : public false_type{};
0122 template <> struct is_signed<volatile unsigned long> : public false_type{};
0123 template <> struct is_signed<const volatile unsigned long> : public false_type{};
0124 #ifdef BOOST_HAS_LONG_LONG
0125 template <> struct is_signed< ::boost::long_long_type> : public true_type{};
0126 template <> struct is_signed<const ::boost::long_long_type> : public true_type{};
0127 template <> struct is_signed<volatile ::boost::long_long_type> : public true_type{};
0128 template <> struct is_signed<const volatile ::boost::long_long_type> : public true_type{};
0129 
0130 template <> struct is_signed< ::boost::ulong_long_type> : public false_type{};
0131 template <> struct is_signed<const ::boost::ulong_long_type> : public false_type{};
0132 template <> struct is_signed<volatile ::boost::ulong_long_type> : public false_type{};
0133 template <> struct is_signed<const volatile ::boost::ulong_long_type> : public false_type{};
0134 #endif
0135 #if defined(CHAR_MIN) 
0136 #if CHAR_MIN != 0
0137 template <> struct is_signed<char> : public true_type{};
0138 template <> struct is_signed<const char> : public true_type{};
0139 template <> struct is_signed<volatile char> : public true_type{};
0140 template <> struct is_signed<const volatile char> : public true_type{};
0141 #else
0142 template <> struct is_signed<char> : public false_type{};
0143 template <> struct is_signed<const char> : public false_type{};
0144 template <> struct is_signed<volatile char> : public false_type{};
0145 template <> struct is_signed<const volatile char> : public false_type{};
0146 #endif
0147 #endif
0148 #if defined(WCHAR_MIN) && !defined(BOOST_NO_INTRINSIC_WCHAR_T)
0149 #if WCHAR_MIN != 0
0150 template <> struct is_signed<wchar_t> : public true_type{};
0151 template <> struct is_signed<const wchar_t> : public true_type{};
0152 template <> struct is_signed<volatile wchar_t> : public true_type{};
0153 template <> struct is_signed<const volatile wchar_t> : public true_type{};
0154 #else
0155 template <> struct is_signed<wchar_t> : public false_type{};
0156 template <> struct is_signed<const wchar_t> : public false_type{};
0157 template <> struct is_signed<volatile wchar_t> : public false_type{};
0158 template <> struct is_signed<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