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_signed.hpp in vendors/XIOS/current/extern/boost/include/boost/type_traits – NEMO

source: vendors/XIOS/current/extern/boost/include/boost/type_traits/is_signed.hpp @ 3408

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

importing initial XIOS vendor drop

  • Property svn:keywords set to Id
File size: 4.5 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_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
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_signed_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_signed_helper
39{
40   typedef typename remove_cv<T>::type no_cv_t;
41   BOOST_STATIC_CONSTANT(bool, value = (!(::boost::detail::is_signed_values<T>::minus_one  > boost::detail::is_signed_values<T>::zero)));
42};
43
44template <bool integral_type>
45struct is_signed_select_helper
46{
47   template <class T>
48   struct rebind
49   {
50      typedef is_signed_helper<T> type;
51   };
52};
53
54template <>
55struct is_signed_select_helper<false>
56{
57   template <class T>
58   struct rebind
59   {
60      typedef false_type type;
61   };
62};
63
64template <class T>
65struct is_signed_imp
66{
67   typedef is_signed_select_helper< 
68      ::boost::type_traits::ice_or<
69         ::boost::is_integral<T>::value,
70         ::boost::is_enum<T>::value>::value
71   > selector;
72   typedef typename selector::template rebind<T> binder;
73   typedef typename binder::type type;
74#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
75   BOOST_STATIC_CONSTANT(bool, value = is_signed_imp<T>::type::value);
76#else
77   BOOST_STATIC_CONSTANT(bool, value = type::value);
78#endif
79};
80
81#else
82
83template <class T> struct is_signed_imp : public false_type{};
84template <> struct is_signed_imp<signed char> : public true_type{};
85template <> struct is_signed_imp<const signed char> : public true_type{};
86template <> struct is_signed_imp<volatile signed char> : public true_type{};
87template <> struct is_signed_imp<const volatile signed char> : public true_type{};
88template <> struct is_signed_imp<short> : public true_type{};
89template <> struct is_signed_imp<const short> : public true_type{};
90template <> struct is_signed_imp<volatile short> : public true_type{};
91template <> struct is_signed_imp<const volatile short> : public true_type{};
92template <> struct is_signed_imp<int> : public true_type{};
93template <> struct is_signed_imp<const int> : public true_type{};
94template <> struct is_signed_imp<volatile int> : public true_type{};
95template <> struct is_signed_imp<const volatile int> : public true_type{};
96template <> struct is_signed_imp<long> : public true_type{};
97template <> struct is_signed_imp<const long> : public true_type{};
98template <> struct is_signed_imp<volatile long> : public true_type{};
99template <> struct is_signed_imp<const volatile long> : public true_type{};
100#ifdef BOOST_HAS_LONG_LONG
101template <> struct is_signed_imp<long long> : public true_type{};
102template <> struct is_signed_imp<const long long> : public true_type{};
103template <> struct is_signed_imp<volatile long long> : public true_type{};
104template <> struct is_signed_imp<const volatile long long> : public true_type{};
105#endif
106#if defined(CHAR_MIN) && (CHAR_MIN != 0)
107template <> struct is_signed_imp<char> : public true_type{};
108template <> struct is_signed_imp<const char> : public true_type{};
109template <> struct is_signed_imp<volatile char> : public true_type{};
110template <> struct is_signed_imp<const volatile char> : public true_type{};
111#endif
112#if defined(WCHAR_MIN) && (WCHAR_MIN != 0)
113template <> struct is_signed_imp<wchar_t> : public true_type{};
114template <> struct is_signed_imp<const wchar_t> : public true_type{};
115template <> struct is_signed_imp<volatile wchar_t> : public true_type{};
116template <> struct is_signed_imp<const volatile wchar_t> : public true_type{};
117#endif
118
119#endif
120
121}
122
123#endif // !defined( __CODEGEARC__ )
124
125#if defined( __CODEGEARC__ )
126BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_signed,T,__is_signed(T))
127#else
128BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_signed,T,::boost::detail::is_signed_imp<T>::value)
129#endif
130
131} // namespace boost
132
133#include <boost/type_traits/detail/bool_trait_undef.hpp>
134
135#endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED
Note: See TracBrowser for help on using the repository browser.