STXXL  1.4.0
 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 defined(__GXX_EXPERIMENTAL_CXX0X__)
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 
27 
29 
30 namespace compat {
31 
32 #if defined(__GXX_EXPERIMENTAL_CXX0X__)
33 using std::remove_const;
34 #elif defined(__GNUG__) && (__GNUC__ >= 4)
35 using std::tr1::remove_const;
36 #elif STXXL_BOOST_CONFIG
37 using boost::remove_const;
38 #else
39 template <typename _Tp>
41 {
42  typedef _Tp type;
43 };
44 
45 template <typename _Tp>
46 struct remove_const<_Tp const>
47 {
48  typedef _Tp type;
49 };
50 #endif
51 
52 #if defined(__GNUG__) && ((__GNUC__ * 10000 + __GNUC_MINOR__ * 100) < 40300)
53 // That is a small subset of what GCC 4.3 does:
54 
55 // Utility for finding the signed versions of unsigned integral types.
56 template <typename _Tp>
57 struct __make_signed
58 {
59  typedef _Tp __type;
60 };
61 
62 template <>
63 struct __make_signed<char>
64 {
65  typedef signed char __type;
66 };
67 
68 template <>
69 struct __make_signed<unsigned char>
70 {
71  typedef signed char __type;
72 };
73 
74 template <>
75 struct __make_signed<unsigned short>
76 {
77  typedef signed short __type;
78 };
79 
80 template <>
81 struct __make_signed<unsigned int>
82 {
83  typedef signed int __type;
84 };
85 
86 template <>
87 struct __make_signed<unsigned long>
88 {
89  typedef signed long __type;
90 };
91 
92 template <>
93 struct __make_signed<unsigned long long>
94 {
95  typedef signed long long __type;
96 };
97 
98 
99 template <typename _Tp>
100 struct make_signed
101 {
102  typedef typename __make_signed<_Tp>::__type type;
103 };
104 #endif
105 
106 } // namespace compat
107 
109 
110 #endif // !STXXL_COMPAT_TYPE_TRAITS_HEADER
#define STXXL_BEGIN_NAMESPACE
Definition: namespace.h:16
#define STXXL_END_NAMESPACE
Definition: namespace.h:17