]> git.lyx.org Git - lyx.git/blob - boost/boost/type_traits/is_signed.hpp
update to boost 1.41.0
[lyx.git] / boost / boost / type_traits / is_signed.hpp
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_SIGNED_HPP_INCLUDED
11 #define BOOST_TT_IS_SIGNED_HPP_INCLUDED
12
13 #include <boost/type_traits/is_integral.hpp>
14 #include <boost/type_traits/remove_cv.hpp>
15 #include <boost/type_traits/is_enum.hpp>
16 #include <boost/type_traits/detail/ice_or.hpp>
17
18 // should be the last #include
19 #include <boost/type_traits/detail/bool_trait_def.hpp>
20
21 namespace boost {
22
23 #if !defined( __CODEGEARC__ )
24
25 namespace detail{
26
27 #if !(defined(__EDG_VERSION__) && __EDG_VERSION__ <= 238)
28
29 template <class T>
30 struct is_signed_helper
31 {
32    typedef typename remove_cv<T>::type no_cv_t;
33    BOOST_STATIC_CONSTANT(bool, value = (!(static_cast<no_cv_t>(-1) > 0)));
34 };
35
36 template <bool integral_type>
37 struct is_signed_select_helper
38 {
39    template <class T>
40    struct rebind
41    {
42       typedef is_signed_helper<T> type;
43    };
44 };
45
46 template <>
47 struct is_signed_select_helper<false>
48 {
49    template <class T>
50    struct rebind
51    {
52       typedef false_type type;
53    };
54 };
55
56 template <class T>
57 struct is_signed_imp
58 {
59    typedef is_signed_select_helper< 
60       ::boost::type_traits::ice_or<
61          ::boost::is_integral<T>::value,
62          ::boost::is_enum<T>::value>::value 
63    > selector;
64    typedef typename selector::template rebind<T> binder;
65    typedef typename binder::type type;
66 #if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
67    BOOST_STATIC_CONSTANT(bool, value = is_signed_imp<T>::type::value);
68 #else
69    BOOST_STATIC_CONSTANT(bool, value = type::value);
70 #endif
71 };
72
73 #else
74
75 template <class T> struct is_signed_imp : public false_type{};
76 template <> struct is_signed_imp<signed char> : public true_type{};
77 template <> struct is_signed_imp<const signed char> : public true_type{};
78 template <> struct is_signed_imp<volatile signed char> : public true_type{};
79 template <> struct is_signed_imp<const volatile signed char> : public true_type{};
80 template <> struct is_signed_imp<short> : public true_type{};
81 template <> struct is_signed_imp<const short> : public true_type{};
82 template <> struct is_signed_imp<volatile short> : public true_type{};
83 template <> struct is_signed_imp<const volatile short> : public true_type{};
84 template <> struct is_signed_imp<int> : public true_type{};
85 template <> struct is_signed_imp<const int> : public true_type{};
86 template <> struct is_signed_imp<volatile int> : public true_type{};
87 template <> struct is_signed_imp<const volatile int> : public true_type{};
88 template <> struct is_signed_imp<long> : public true_type{};
89 template <> struct is_signed_imp<const long> : public true_type{};
90 template <> struct is_signed_imp<volatile long> : public true_type{};
91 template <> struct is_signed_imp<const volatile long> : public true_type{};
92 #ifdef BOOST_HAS_LONG_LONG
93 template <> struct is_signed_imp<long long> : public true_type{};
94 template <> struct is_signed_imp<const long long> : public true_type{};
95 template <> struct is_signed_imp<volatile long long> : public true_type{};
96 template <> struct is_signed_imp<const volatile long long> : public true_type{};
97 #endif
98 #if defined(CHAR_MIN) && (CHAR_MIN != 0)
99 template <> struct is_signed_imp<char> : public true_type{};
100 template <> struct is_signed_imp<const char> : public true_type{};
101 template <> struct is_signed_imp<volatile char> : public true_type{};
102 template <> struct is_signed_imp<const volatile char> : public true_type{};
103 #endif
104 #if defined(WCHAR_MIN) && (WCHAR_MIN != 0)
105 template <> struct is_signed_imp<wchar_t> : public true_type{};
106 template <> struct is_signed_imp<const wchar_t> : public true_type{};
107 template <> struct is_signed_imp<volatile wchar_t> : public true_type{};
108 template <> struct is_signed_imp<const volatile wchar_t> : public true_type{};
109 #endif
110
111 #endif
112
113 }
114
115 #endif // !defined( __CODEGEARC__ )
116
117 #if defined( __CODEGEARC__ )
118 BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_signed,T,__is_signed(T))
119 #else
120 BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_signed,T,::boost::detail::is_signed_imp<T>::value)
121 #endif
122
123 } // namespace boost
124
125 #include <boost/type_traits/detail/bool_trait_undef.hpp>
126
127 #endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED