Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef _EXT_TYPE_TRAITS
00030 #define _EXT_TYPE_TRAITS 1
00031
00032 #pragma GCC system_header
00033
00034 #include <bits/c++config.h>
00035 #include <bits/cpp_type_traits.h>
00036
00037 namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
00038 {
00039 _GLIBCXX_BEGIN_NAMESPACE_VERSION
00040
00041
00042 template<bool, typename>
00043 struct __enable_if
00044 { };
00045
00046 template<typename _Tp>
00047 struct __enable_if<true, _Tp>
00048 { typedef _Tp __type; };
00049
00050
00051
00052 template<bool _Cond, typename _Iftrue, typename _Iffalse>
00053 struct __conditional_type
00054 { typedef _Iftrue __type; };
00055
00056 template<typename _Iftrue, typename _Iffalse>
00057 struct __conditional_type<false, _Iftrue, _Iffalse>
00058 { typedef _Iffalse __type; };
00059
00060
00061
00062 template<typename _Tp>
00063 struct __add_unsigned
00064 {
00065 private:
00066 typedef __enable_if<std::__is_integer<_Tp>::__value, _Tp> __if_type;
00067
00068 public:
00069 typedef typename __if_type::__type __type;
00070 };
00071
00072 template<>
00073 struct __add_unsigned<char>
00074 { typedef unsigned char __type; };
00075
00076 template<>
00077 struct __add_unsigned<signed char>
00078 { typedef unsigned char __type; };
00079
00080 template<>
00081 struct __add_unsigned<short>
00082 { typedef unsigned short __type; };
00083
00084 template<>
00085 struct __add_unsigned<int>
00086 { typedef unsigned int __type; };
00087
00088 template<>
00089 struct __add_unsigned<long>
00090 { typedef unsigned long __type; };
00091
00092 template<>
00093 struct __add_unsigned<long long>
00094 { typedef unsigned long long __type; };
00095
00096
00097 template<>
00098 struct __add_unsigned<bool>;
00099
00100 template<>
00101 struct __add_unsigned<wchar_t>;
00102
00103
00104
00105 template<typename _Tp>
00106 struct __remove_unsigned
00107 {
00108 private:
00109 typedef __enable_if<std::__is_integer<_Tp>::__value, _Tp> __if_type;
00110
00111 public:
00112 typedef typename __if_type::__type __type;
00113 };
00114
00115 template<>
00116 struct __remove_unsigned<char>
00117 { typedef signed char __type; };
00118
00119 template<>
00120 struct __remove_unsigned<unsigned char>
00121 { typedef signed char __type; };
00122
00123 template<>
00124 struct __remove_unsigned<unsigned short>
00125 { typedef short __type; };
00126
00127 template<>
00128 struct __remove_unsigned<unsigned int>
00129 { typedef int __type; };
00130
00131 template<>
00132 struct __remove_unsigned<unsigned long>
00133 { typedef long __type; };
00134
00135 template<>
00136 struct __remove_unsigned<unsigned long long>
00137 { typedef long long __type; };
00138
00139
00140 template<>
00141 struct __remove_unsigned<bool>;
00142
00143 template<>
00144 struct __remove_unsigned<wchar_t>;
00145
00146
00147
00148 template<typename _Type>
00149 inline bool
00150 __is_null_pointer(_Type* __ptr)
00151 { return __ptr == 0; }
00152
00153 template<typename _Type>
00154 inline bool
00155 __is_null_pointer(_Type)
00156 { return false; }
00157
00158
00159
00160 template<typename _Tp, bool = std::__is_integer<_Tp>::__value>
00161 struct __promote
00162 { typedef double __type; };
00163
00164 template<typename _Tp>
00165 struct __promote<_Tp, false>
00166 { typedef _Tp __type; };
00167
00168 template<typename _Tp, typename _Up>
00169 struct __promote_2
00170 {
00171 private:
00172 typedef typename __promote<_Tp>::__type __type1;
00173 typedef typename __promote<_Up>::__type __type2;
00174
00175 public:
00176 typedef __typeof__(__type1() + __type2()) __type;
00177 };
00178
00179 template<typename _Tp, typename _Up, typename _Vp>
00180 struct __promote_3
00181 {
00182 private:
00183 typedef typename __promote<_Tp>::__type __type1;
00184 typedef typename __promote<_Up>::__type __type2;
00185 typedef typename __promote<_Vp>::__type __type3;
00186
00187 public:
00188 typedef __typeof__(__type1() + __type2() + __type3()) __type;
00189 };
00190
00191 template<typename _Tp, typename _Up, typename _Vp, typename _Wp>
00192 struct __promote_4
00193 {
00194 private:
00195 typedef typename __promote<_Tp>::__type __type1;
00196 typedef typename __promote<_Up>::__type __type2;
00197 typedef typename __promote<_Vp>::__type __type3;
00198 typedef typename __promote<_Wp>::__type __type4;
00199
00200 public:
00201 typedef __typeof__(__type1() + __type2() + __type3() + __type4()) __type;
00202 };
00203
00204 _GLIBCXX_END_NAMESPACE_VERSION
00205 }
00206
00207 #endif