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

Unified Diff: Source/wtf/HashTraits.h

Issue 185903002: HashTraits<RawPtr> uses 'nullptr' (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 10 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/wtf/HashTraits.h
diff --git a/Source/wtf/HashTraits.h b/Source/wtf/HashTraits.h
index af1fb02bba3a8e9cc9a6a1e5b0dd09b79e8c3197..6c5a83bc17acd864443f1c4f13e3f0cadc831de4 100644
--- a/Source/wtf/HashTraits.h
+++ b/Source/wtf/HashTraits.h
@@ -191,6 +191,12 @@ namespace WTF {
};
template<typename T> struct HashTraits<RawPtr<T> > : SimpleClassHashTraits<RawPtr<T> > {
+ typedef std::nullptr_t EmptyValueType;
+ static EmptyValueType emptyValue() { return nullptr; }
+
+ static const bool hasIsEmptyValueFunction = true;
+ static bool isEmptyValue(const RawPtr<T>& value) { return !value; }
+
static const bool needsDestruction = false;
typedef T* PeekInType;
typedef T* PassInType;
@@ -207,7 +213,10 @@ namespace WTF {
static void store(const U& value, RawPtr<T>& storage) { storage = value; }
static PeekOutType peek(const RawPtr<T>& value) { return value; }
+ static PeekOutType peek(std::nullptr_t) { return 0; }
+
static PassOutType passOut(const RawPtr<T>& value) { return value; }
+ static PassOutType passOut(std::nullptr_t) { return 0; }
};
template<> struct HashTraits<String> : SimpleClassHashTraits<String> {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698