Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2642)

Unified Diff: Source/wtf/TypeTraits.h

Issue 594763002: Revert of Expanding Type Traits to make Vector use mem ops more. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/wtf/TypeTraits.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/wtf/TypeTraits.h
diff --git a/Source/wtf/TypeTraits.h b/Source/wtf/TypeTraits.h
index 908f06cf91733e16c98e16f9f751b478e1d138ec..3637304b4680f221d39d09d3591ca9157513150e 100644
--- a/Source/wtf/TypeTraits.h
+++ b/Source/wtf/TypeTraits.h
@@ -29,7 +29,7 @@
// The following are provided in this file:
//
// IsInteger<T>::value
- // IsPod<T>::value
+ // IsPod<T>::value, see the definition for a note about its limitations
// IsConvertibleToInteger<T>::value
//
// IsArray<T>::value
@@ -72,26 +72,6 @@
template<typename T> struct IsArithmetic { static const bool value = IsInteger<T>::value || IsFloatingPoint<T>::value; };
- template<typename T> struct IsPointer {
- static const bool value = false;
- };
-
- template<typename P> struct IsPointer<const P*> {
- static const bool value = true;
- };
-
- template<typename P> struct IsPointer<P*> {
- static const bool value = true;
- };
-
- template<typename T> struct IsEnum {
- static const bool value = __is_enum(T);
- };
-
- template<typename T> struct IsScalar {
- static const bool value = IsEnum<T>::value || IsArithmetic<T>::value || IsPointer<T>::value;
- };
-
template<typename T> struct IsWeak { static const bool value = false; };
enum WeakHandlingFlag {
@@ -99,25 +79,10 @@
WeakHandlingInCollections
};
- template <typename T> struct IsPod {
- static const bool value = __is_pod(T);
- };
-
- template <typename T> struct IsTriviallyCopyAssignable {
- static const bool value = __has_trivial_assign(T);
- };
-
- template <typename T> struct IsTriviallyMoveAssignable {
- static const bool value = __has_trivial_assign(T);
- };
-
- template <typename T> struct IsTriviallyDefaultConstructible {
- static const bool value = __has_trivial_constructor(T);
- };
-
- template <typename T> struct IsTriviallyDestructible {
- static const bool value = __has_trivial_destructor(T);
- };
+ // IsPod is misnamed as it doesn't cover all plain old data (pod) types.
+ // Specifically, it doesn't allow for enums or for structs.
+ template <typename T> struct IsPod { static const bool value = IsArithmetic<T>::value; };
+ template <typename P> struct IsPod<P*> { static const bool value = true; };
template<typename T> class IsConvertibleToInteger {
// Avoid "possible loss of data" warning when using Microsoft's C++ compiler
« no previous file with comments | « no previous file | Source/wtf/TypeTraits.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698