STXXL  1.4-dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
type_traits.h
Go to the documentation of this file.
1 /***************************************************************************
2  * include/stxxl/bits/compat/type_traits.h
3  *
4  * Part of the STXXL. See http://stxxl.sourceforge.net
5  *
6  * Copyright (C) 2009-2011 Andreas Beckmann <[email protected]>
7  *
8  * Distributed under the Boost Software License, Version 1.0.
9  * (See accompanying file LICENSE_1_0.txt or copy at
10  * http://www.boost.org/LICENSE_1_0.txt)
11  **************************************************************************/
12 
13 #ifndef STXXL_COMPAT_TYPE_TRAITS_HEADER
14 #define STXXL_COMPAT_TYPE_TRAITS_HEADER
15 
16 #include <stxxl/bits/config.h>
17 #include <stxxl/bits/namespace.h>
18 
19 #if __cplusplus >= 201103L
20 #include <type_traits>
21 #elif defined(__GNUG__) && (__GNUC__ >= 4)
22 #include <tr1/type_traits>
23 #elif STXXL_BOOST_CONFIG
24 #include <boost/type_traits/remove_const.hpp>
25 #endif
26 
28 
29 namespace compat {
30 
31 #if __cplusplus >= 201103L
32 using std::remove_const;
33 #elif defined(__GNUG__) && (__GNUC__ >= 4)
34 using std::tr1::remove_const;
35 #elif STXXL_BOOST_CONFIG
36 using boost::remove_const;
37 #else
38 template <typename Type>
40 {
41  typedef Type type;
42 };
43 
44 template <typename Type>
45 struct remove_const<Type const>
46 {
47  typedef Type type;
48 };
49 #endif
50 
51 #if defined(__GNUG__) && ((__GNUC__ * 10000 + __GNUC_MINOR__ * 100) < 40300)
52 // That is a small subset of what GCC 4.3 does:
53 
54 // Utility for finding the signed versions of unsigned integral types.
55 template <typename Type>
56 struct _make_signed
57 {
58  typedef Type type;
59 };
60 
61 template <>
62 struct _make_signed<char>
63 {
64  typedef signed char type;
65 };
66 
67 template <>
68 struct _make_signed<unsigned char>
69 {
70  typedef signed char type;
71 };
72 
73 template <>
74 struct _make_signed<unsigned short>
75 {
76  typedef signed short type;
77 };
78 
79 template <>
80 struct _make_signed<unsigned int>
81 {
82  typedef signed int type;
83 };
84 
85 template <>
86 struct _make_signed<unsigned long>
87 {
88  typedef signed long type;
89 };
90 
91 template <>
92 struct _make_signed<unsigned long long>
93 {
94  typedef signed long long type;
95 };
96 
97 template <typename Type>
98 struct make_signed
99 {
100  typedef typename _make_signed<Type>::type type;
101 };
102 #endif
103 
104 } // namespace compat
105 
107 
108 #endif // !STXXL_COMPAT_TYPE_TRAITS_HEADER
#define STXXL_BEGIN_NAMESPACE
Definition: namespace.h:16
#define STXXL_END_NAMESPACE
Definition: namespace.h:17