cpp_type_traits.h
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
00030
00031
00032
00033
00034
00035
00036
00037 #ifndef _CPP_TYPE_TRAITS_H
00038 #define _CPP_TYPE_TRAITS_H 1
00039
00040 #pragma GCC system_header
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067 namespace std
00068 {
00069
00070 template<typename, typename>
00071 struct __are_same
00072 {
00073 enum
00074 {
00075 _M_type = 0
00076 };
00077 };
00078
00079 template<typename _Tp>
00080 struct __are_same<_Tp, _Tp>
00081 {
00082 enum
00083 {
00084 _M_type = 1
00085 };
00086 };
00087
00088
00089 template<typename, bool>
00090 struct __enable_if
00091 {
00092 };
00093
00094 template<typename _Tp>
00095 struct __enable_if<_Tp, true>
00096 {
00097 typedef _Tp _M_type;
00098 };
00099
00100
00101 template<typename _Tp>
00102 struct __is_void
00103 {
00104 enum
00105 {
00106 _M_type = 0
00107 };
00108 };
00109
00110 template<>
00111 struct __is_void<void>
00112 {
00113 enum
00114 {
00115 _M_type = 1
00116 };
00117 };
00118
00119
00120
00121
00122 template<typename _Tp>
00123 struct __is_integer
00124 {
00125 enum
00126 {
00127 _M_type = 0
00128 };
00129 };
00130
00131
00132
00133
00134 template<>
00135 struct __is_integer<bool>
00136 {
00137 enum
00138 {
00139 _M_type = 1
00140 };
00141 };
00142
00143 template<>
00144 struct __is_integer<char>
00145 {
00146 enum
00147 {
00148 _M_type = 1
00149 };
00150 };
00151
00152 template<>
00153 struct __is_integer<signed char>
00154 {
00155 enum
00156 {
00157 _M_type = 1
00158 };
00159 };
00160
00161 template<>
00162 struct __is_integer<unsigned char>
00163 {
00164 enum
00165 {
00166 _M_type = 1
00167 };
00168 };
00169
00170 # ifdef _GLIBCXX_USE_WCHAR_T
00171 template<>
00172 struct __is_integer<wchar_t>
00173 {
00174 enum
00175 {
00176 _M_type = 1
00177 };
00178 };
00179 # endif
00180
00181 template<>
00182 struct __is_integer<short>
00183 {
00184 enum
00185 {
00186 _M_type = 1
00187 };
00188 };
00189
00190 template<>
00191 struct __is_integer<unsigned short>
00192 {
00193 enum
00194 {
00195 _M_type = 1
00196 };
00197 };
00198
00199 template<>
00200 struct __is_integer<int>
00201 {
00202 enum
00203 {
00204 _M_type = 1
00205 };
00206 };
00207
00208 template<>
00209 struct __is_integer<unsigned int>
00210 {
00211 enum
00212 {
00213 _M_type = 1
00214 };
00215 };
00216
00217 template<>
00218 struct __is_integer<long>
00219 {
00220 enum
00221 {
00222 _M_type = 1
00223 };
00224 };
00225
00226 template<>
00227 struct __is_integer<unsigned long>
00228 {
00229 enum
00230 {
00231 _M_type = 1
00232 };
00233 };
00234
00235 template<>
00236 struct __is_integer<long long>
00237 {
00238 enum
00239 {
00240 _M_type = 1
00241 };
00242 };
00243
00244 template<>
00245 struct __is_integer<unsigned long long>
00246 {
00247 enum
00248 {
00249 _M_type = 1
00250 };
00251 };
00252
00253
00254
00255
00256 template<typename _Tp>
00257 struct __is_floating
00258 {
00259 enum
00260 {
00261 _M_type = 0
00262 };
00263 };
00264
00265
00266 template<>
00267 struct __is_floating<float>
00268 {
00269 enum
00270 {
00271 _M_type = 1
00272 };
00273 };
00274
00275 template<>
00276 struct __is_floating<double>
00277 {
00278 enum
00279 {
00280 _M_type = 1
00281 };
00282 };
00283
00284 template<>
00285 struct __is_floating<long double>
00286 {
00287 enum
00288 {
00289 _M_type = 1
00290 };
00291 };
00292
00293
00294
00295
00296 template<typename _Tp>
00297 struct __is_arithmetic
00298 {
00299 enum
00300 {
00301 _M_type = __is_integer<_Tp>::_M_type || __is_floating<_Tp>::_M_type
00302 };
00303 };
00304
00305
00306
00307
00308 template<typename _Tp>
00309 struct __is_fundamental
00310 {
00311 enum
00312 {
00313 _M_type = __is_void<_Tp>::_M_type || __is_arithmetic<_Tp>::_M_type
00314 };
00315 };
00316
00317
00318
00319
00320
00321
00322
00323 namespace __gnu_internal
00324 {
00325 typedef char __one;
00326 typedef char __two[2];
00327
00328 template <typename _Tp>
00329 __one __test_type (int _Tp::*);
00330 template <typename _Tp>
00331 __two& __test_type (...);
00332 }
00333
00334
00335 template<typename _Tp>
00336 struct __is_pod
00337 {
00338 enum
00339 {
00340 _M_type = (sizeof(__gnu_internal::__test_type<_Tp>(0)) != sizeof(__gnu_internal::__one))
00341 };
00342 };
00343
00344 }
00345
00346
00347 #endif //_CPP_TYPE_TRAITS_H
Generated on Wed Jun 9 11:18:17 2004 for libstdc++-v3 Source by
1.3.7