OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2009, 2010 Google Inc. All rights reserved. | 3 * Copyright (C) 2009, 2010 Google Inc. All rights reserved. |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 public: | 223 public: |
224 typedef typename Conditional< | 224 typedef typename Conditional< |
225 IsArray<U>::value, | 225 IsArray<U>::value, |
226 typename RemoveExtent<U>::Type*, | 226 typename RemoveExtent<U>::Type*, |
227 typename RemoveConstVolatile<U>::Type | 227 typename RemoveConstVolatile<U>::Type |
228 >::Type Type; | 228 >::Type Type; |
229 }; | 229 }; |
230 | 230 |
231 #if COMPILER(CLANG) || GCC_VERSION_AT_LEAST(4, 6, 0) || (defined(_MSC_VER) && (_
MSC_VER >= 1400) && (_MSC_VER < 1600) && !defined(__INTEL_COMPILER)) | 231 #if COMPILER(CLANG) || GCC_VERSION_AT_LEAST(4, 6, 0) || (defined(_MSC_VER) && (_
MSC_VER >= 1400) && (_MSC_VER < 1600) && !defined(__INTEL_COMPILER)) |
232 // VC8 (VS2005) and later has __has_trivial_constructor and __has_trivial_de
structor, | 232 // VC8 (VS2005) and later has __has_trivial_constructor and __has_trivial_de
structor, |
233 // but the implementation returns false for built-in types. We add the extra
IsPod condition to | 233 // but the implementation returns false for built-in types. We add the extra
IsPod condition to |
234 // work around this. | 234 // work around this. |
235 template <typename T> struct HasTrivialConstructor { | 235 template <typename T> struct HasTrivialConstructor { |
236 static const bool value = __has_trivial_constructor(T) || IsPod<RemoveCo
nstVolatile<T> >::value; | 236 static const bool value = __has_trivial_constructor(T) || IsPod<RemoveCo
nstVolatile<T> >::value; |
237 }; | 237 }; |
238 template <typename T> struct HasTrivialDestructor { | 238 template <typename T> struct HasTrivialDestructor { |
239 static const bool value = __has_trivial_destructor(T) || IsPod<RemoveCon
stVolatile<T> >::value; | 239 static const bool value = __has_trivial_destructor(T) || IsPod<RemoveCon
stVolatile<T> >::value; |
240 }; | 240 }; |
241 #elif (defined(__GLIBCXX__) && (__GLIBCXX__ >= 20070724) && defined(__GXX_EXPERI
MENTAL_CXX0X__)) || (defined(_MSC_VER) && (_MSC_VER >= 1600)) | 241 #elif (defined(__GLIBCXX__) && (__GLIBCXX__ >= 20070724) && defined(__GXX_EXPERI
MENTAL_CXX0X__)) || (defined(_MSC_VER) && (_MSC_VER >= 1600)) |
242 // GCC's libstdc++ 20070724 and later supports C++ TR1 type_traits in the st
d namespace. | 242 // GCC's libstdc++ 20070724 and later supports C++ TR1 type_traits in the st
d namespace. |
243 // VC10 (VS2010) and later support C++ TR1 type_traits in the std::tr1 names
pace. | 243 // VC10 (VS2010) and later support C++ TR1 type_traits in the std::tr1 names
pace. |
244 template<typename T> struct HasTrivialConstructor : public std::tr1::has_tri
vial_constructor<T> { }; | 244 template<typename T> struct HasTrivialConstructor : public std::tr1::has_tri
vial_constructor<T> { }; |
245 template<typename T> struct HasTrivialDestructor : public std::tr1::has_triv
ial_destructor<T> { }; | 245 template<typename T> struct HasTrivialDestructor : public std::tr1::has_triv
ial_destructor<T> { }; |
246 #else | 246 #else |
247 // For compilers that don't support detection of trivial constructors and de
structors in classes, | 247 // For compilers that don't support detection of trivial constructors and de
structors in classes, |
248 // we use a template that returns true for any POD type that IsPod can detec
t (see IsPod caveats above), | 248 // we use a template that returns true for any POD type that IsPod can detec
t (see IsPod caveats above), |
249 // but false for all other types (which includes all classes). This will giv
e false negatives, which can hurt | 249 // but false for all other types (which includes all classes). This will giv
e false negatives, which can hurt |
250 // performance, but avoids false positives, which would result in incorrect
behavior. | 250 // performance, but avoids false positives, which would result in incorrect
behavior. |
251 template <typename T> struct HasTrivialConstructor { | 251 template <typename T> struct HasTrivialConstructor { |
252 static const bool value = IsPod<RemoveConstVolatile<T> >::value; | 252 static const bool value = IsPod<RemoveConstVolatile<T> >::value; |
253 }; | 253 }; |
254 template <typename T> struct HasTrivialDestructor { | 254 template <typename T> struct HasTrivialDestructor { |
255 static const bool value = IsPod<RemoveConstVolatile<T> >::value; | 255 static const bool value = IsPod<RemoveConstVolatile<T> >::value; |
256 }; | 256 }; |
257 #endif | 257 #endif |
258 | 258 |
259 } // namespace WTF | 259 } // namespace WTF |
260 | 260 |
261 #endif // TypeTraits_h | 261 #endif // TypeTraits_h |
OLD | NEW |