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

Unified Diff: third_party/WebKit/Source/wtf/TypeTraits.h

Issue 1477213003: More switching to standard type traits (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use std::is_base_of Created 5 years 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
Index: third_party/WebKit/Source/wtf/TypeTraits.h
diff --git a/third_party/WebKit/Source/wtf/TypeTraits.h b/third_party/WebKit/Source/wtf/TypeTraits.h
index c4a8ab85f5e01e02346fd23241f8406a8ba4d29d..6dcaaf77e7bd6d52738a2faed42faa589675c6c1 100644
--- a/third_party/WebKit/Source/wtf/TypeTraits.h
+++ b/third_party/WebKit/Source/wtf/TypeTraits.h
@@ -39,17 +39,6 @@ inline const char* getStringWithTypeName()
template<typename T> class RawPtr;
-// The following are provided in this file:
-//
-// IsConvertibleToInteger<T>::value
-//
-// IsSameType<T, U>::value
-//
-// static_assert's in TypeTraits.cpp illustrate their usage and what they do.
-
-template <bool Predicate, class T = void> struct EnableIf;
-template <class T> struct EnableIf<true, T> { typedef T Type; };
-
template <typename T> struct IsWeak {
static const bool value = false;
};
@@ -75,53 +64,6 @@ template <typename T> struct IsTriviallyDestructible {
static const bool value = __has_trivial_destructor(T);
};
-template <typename T> class IsConvertibleToInteger {
- // Avoid "possible loss of data" warning when using Microsoft's C++ compiler
- // by not converting int's to doubles.
- template <bool performCheck, typename U> class IsConvertibleToDouble;
- template <typename U> class IsConvertibleToDouble<false, U> {
- public:
- static const bool value = false;
- };
-
- template <typename U> class IsConvertibleToDouble<true, U> {
- typedef char YesType;
- struct NoType {
- char padding[8];
- };
-
- static YesType floatCheck(long double);
- static NoType floatCheck(...);
- static T& t;
- public:
- static const bool value = sizeof(floatCheck(t)) == sizeof(YesType);
- };
-
-public:
- static const bool value = std::is_integral<T>::value || IsConvertibleToDouble<!std::is_integral<T>::value, T>::value;
-};
-
-template <typename T, typename U> struct IsSameType {
- static const bool value = false;
-};
-
-template <typename T> struct IsSameType<T, T> {
- static const bool value = true;
-};
-
-template <typename T, typename U> class IsSubclass {
- typedef char YesType;
- struct NoType {
- char padding[8];
- };
-
- static YesType subclassCheck(U*);
- static NoType subclassCheck(...);
- static T* t;
-public:
- static const bool value = sizeof(subclassCheck(t)) == sizeof(YesType);
-};
-
template <typename T, template <typename... V> class U> class IsSubclassOfTemplate {
typedef char YesType;
struct NoType {
@@ -173,11 +115,6 @@ struct RemoveTemplate<OuterTemplate<T>, OuterTemplate> {
typedef T Type;
};
-// Determines whether this type has a vtable.
-template <typename T> struct IsPolymorphic {
- static const bool value = __is_polymorphic(T);
-};
-
#if COMPILER(MSVC) && !COMPILER(CLANG)
// FIXME: MSVC bug workaround. Remove once MSVC STL is fixed.
// C++ 2011 Spec (ISO/IEC 14882:2011(E)) 20.9.6.2 Table 51 states that
@@ -225,7 +162,7 @@ class NeedsTracing {
} NoType;
// Note that this also checks if a superclass of V has a trace method.
- template <typename V> static YesType checkHasTraceMethod(V* v, blink::Visitor* p = nullptr, typename EnableIf<IsSameType<decltype(v->trace(p)), void>::value>::Type* g = nullptr);
+ template <typename V> static YesType checkHasTraceMethod(V* v, blink::Visitor* p = nullptr, typename std::enable_if<std::is_same<decltype(v->trace(p)), void>::value>::type* g = nullptr);
template <typename V> static NoType checkHasTraceMethod(...);
public:
// We add sizeof(T) to both sides here, because we want it to fail for

Powered by Google App Engine
This is Rietveld 408576698