New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
is_unsigned.hpp in vendors/XIOS/current/extern/boost/include/boost/type_traits – NEMO

source: vendors/XIOS/current/extern/boost/include/boost/type_traits/is_unsigned.hpp @ 3428

Last change on this file since 3428 was 3428, checked in by rblod, 12 years ago

importing initial XIOS vendor drop

File size: 4.6 KB
Line 
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/remove_cv.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
21namespace boost {
22
23#if !defined( __CODEGEARC__ )
24
25namespace detail{
26
27#if !(defined(__EDG_VERSION__) && __EDG_VERSION__ <= 238)
28
29template <class T>
30struct is_unsigned_values
31{
32   typedef typename remove_cv<T>::type no_cv_t;
33   BOOST_STATIC_CONSTANT(no_cv_t, minus_one = (static_cast<no_cv_t>(-1)));
34   BOOST_STATIC_CONSTANT(no_cv_t, zero = (static_cast<no_cv_t>(0)));
35};
36
37template <class T>
38struct is_ununsigned_helper
39{
40   BOOST_STATIC_CONSTANT(bool, value = (::boost::detail::is_unsigned_values<T>::minus_one > ::boost::detail::is_unsigned_values<T>::zero));
41};
42
43template <bool integral_type>
44struct is_ununsigned_select_helper
45{
46   template <class T>
47   struct rebind
48   {
49      typedef is_ununsigned_helper<T> type;
50   };
51};
52
53template <>
54struct is_ununsigned_select_helper<false>
55{
56   template <class T>
57   struct rebind
58   {
59      typedef false_type type;
60   };
61};
62
63template <class T>
64struct is_unsigned_imp
65{
66   typedef is_ununsigned_select_helper< 
67      ::boost::type_traits::ice_or<
68         ::boost::is_integral<T>::value,
69         ::boost::is_enum<T>::value>::value
70   > selector;
71   typedef typename selector::template rebind<T> binder;
72   typedef typename binder::type type;
73   BOOST_STATIC_CONSTANT(bool, value = type::value);
74};
75
76#else
77
78template <class T> struct is_unsigned_imp : public false_type{};
79template <> struct is_unsigned_imp<unsigned char> : public true_type{};
80template <> struct is_unsigned_imp<const unsigned char> : public true_type{};
81template <> struct is_unsigned_imp<volatile unsigned char> : public true_type{};
82template <> struct is_unsigned_imp<const volatile unsigned char> : public true_type{};
83template <> struct is_unsigned_imp<unsigned short> : public true_type{};
84template <> struct is_unsigned_imp<const unsigned short> : public true_type{};
85template <> struct is_unsigned_imp<volatile unsigned short> : public true_type{};
86template <> struct is_unsigned_imp<const volatile unsigned short> : public true_type{};
87template <> struct is_unsigned_imp<unsigned int> : public true_type{};
88template <> struct is_unsigned_imp<const unsigned int> : public true_type{};
89template <> struct is_unsigned_imp<volatile unsigned int> : public true_type{};
90template <> struct is_unsigned_imp<const volatile unsigned int> : public true_type{};
91template <> struct is_unsigned_imp<unsigned long> : public true_type{};
92template <> struct is_unsigned_imp<const unsigned long> : public true_type{};
93template <> struct is_unsigned_imp<volatile unsigned long> : public true_type{};
94template <> struct is_unsigned_imp<const volatile unsigned long> : public true_type{};
95#ifdef BOOST_HAS_LONG_LONG
96template <> struct is_unsigned_imp<unsigned long long> : public true_type{};
97template <> struct is_unsigned_imp<const unsigned long long> : public true_type{};
98template <> struct is_unsigned_imp<volatile unsigned long long> : public true_type{};
99template <> struct is_unsigned_imp<const volatile unsigned long long> : public true_type{};
100#endif
101#if defined(CHAR_MIN) && (CHAR_MIN == 0)
102template <> struct is_unsigned_imp<char> : public true_type{};
103template <> struct is_unsigned_imp<const char> : public true_type{};
104template <> struct is_unsigned_imp<volatile char> : public true_type{};
105template <> struct is_unsigned_imp<const volatile char> : public true_type{};
106#endif
107#if defined(WCHAR_MIN) && (WCHAR_MIN == 0)
108template <> struct is_unsigned_imp<wchar_t> : public true_type{};
109template <> struct is_unsigned_imp<const wchar_t> : public true_type{};
110template <> struct is_unsigned_imp<volatile wchar_t> : public true_type{};
111template <> struct is_unsigned_imp<const volatile wchar_t> : public true_type{};
112#endif
113
114#endif
115
116}
117
118#endif // !defined( __CODEGEARC__ )
119
120#if defined( __CODEGEARC__ )
121BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_unsigned,T,__is_unsigned(T))
122#else
123BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_unsigned,T,::boost::detail::is_unsigned_imp<T>::value)
124#endif
125
126} // namespace boost
127
128#include <boost/type_traits/detail/bool_trait_undef.hpp>
129
130#endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED
Note: See TracBrowser for help on using the repository browser.