Stxxl
1.4.0
|
00001 /*************************************************************************** 00002 * include/stxxl/bits/compat/type_traits.h 00003 * 00004 * Part of the STXXL. See http://stxxl.sourceforge.net 00005 * 00006 * Copyright (C) 2009-2011 Andreas Beckmann <beckmann@cs.uni-frankfurt.de> 00007 * 00008 * Distributed under the Boost Software License, Version 1.0. 00009 * (See accompanying file LICENSE_1_0.txt or copy at 00010 * http://www.boost.org/LICENSE_1_0.txt) 00011 **************************************************************************/ 00012 00013 #ifndef STXXL_HEADER__COMPAT_TYPE_TRAITS_H_ 00014 #define STXXL_HEADER__COMPAT_TYPE_TRAITS_H_ 00015 00016 #if defined(__GXX_EXPERIMENTAL_CXX0X__) 00017 #include <type_traits> 00018 #elif defined(__GNUG__) && (__GNUC__ >= 4) 00019 #include <tr1/type_traits> 00020 #elif defined(STXXL_BOOST_CONFIG) 00021 #include <boost/type_traits/remove_const.hpp> 00022 #endif 00023 00024 #include <stxxl/bits/namespace.h> 00025 00026 00027 __STXXL_BEGIN_NAMESPACE 00028 00029 namespace compat 00030 { 00031 #if defined(__GXX_EXPERIMENTAL_CXX0X__) 00032 using std::remove_const; 00033 #elif defined(__GNUG__) && (__GNUC__ >= 4) 00034 using std::tr1::remove_const; 00035 #elif defined(STXXL_BOOST_CONFIG) 00036 using boost::remove_const; 00037 #else 00038 template <typename _Tp> 00039 struct remove_const 00040 { 00041 typedef _Tp type; 00042 }; 00043 00044 template <typename _Tp> 00045 struct remove_const<_Tp const> 00046 { 00047 typedef _Tp type; 00048 }; 00049 #endif 00050 00051 #if defined(__GNUG__) && ((__GNUC__ * 10000 + __GNUC_MINOR__ * 100) < 40300) 00052 // That is a small subset of what GCC 4.3 does: 00053 00054 // Utility for finding the signed versions of unsigned integral types. 00055 template <typename _Tp> 00056 struct __make_signed 00057 { 00058 typedef _Tp __type; 00059 }; 00060 00061 template <> 00062 struct __make_signed<char> 00063 { 00064 typedef signed char __type; 00065 }; 00066 00067 template <> 00068 struct __make_signed<unsigned char> 00069 { 00070 typedef signed char __type; 00071 }; 00072 00073 template <> 00074 struct __make_signed<unsigned short> 00075 { 00076 typedef signed short __type; 00077 }; 00078 00079 template <> 00080 struct __make_signed<unsigned int> 00081 { 00082 typedef signed int __type; 00083 }; 00084 00085 template <> 00086 struct __make_signed<unsigned long> 00087 { 00088 typedef signed long __type; 00089 }; 00090 00091 template <> 00092 struct __make_signed<unsigned long long> 00093 { 00094 typedef signed long long __type; 00095 }; 00096 00097 00098 template <typename _Tp> 00099 struct make_signed 00100 { 00101 typedef typename __make_signed<_Tp>::__type type; 00102 }; 00103 #endif 00104 } // namespace compat 00105 00106 __STXXL_END_NAMESPACE 00107 00108 #endif // !STXXL_HEADER__COMPAT_TYPE_TRAITS_H_