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

Unified Diff: Source/wtf/RawPtr.h

Issue 170603003: Use nullptr_t for RefPtr, PassRefPtr and RawPtr. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Final rebase 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 | « Source/wtf/PassRefPtr.h ('k') | Source/wtf/RefPtr.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/wtf/RawPtr.h
diff --git a/Source/wtf/RawPtr.h b/Source/wtf/RawPtr.h
index 439d1c2f3b2c43716764446073ced77cd9c41ec9..5fa5480fc34d2014d55ecc596e1263a3f0dc5a4d 100644
--- a/Source/wtf/RawPtr.h
+++ b/Source/wtf/RawPtr.h
@@ -44,8 +44,11 @@ namespace WTF {
template<typename T>
class RawPtr {
+ WTF_DISALLOW_CONSTRUCTION_FROM_ZERO(RawPtr);
+ WTF_DISALLOW_ZERO_ASSIGNMENT(RawPtr);
public:
RawPtr() : m_ptr(0) { }
+ RawPtr(std::nullptr_t) : m_ptr(0) { }
RawPtr(T* ptr) : m_ptr(ptr) { }
RawPtr(const RawPtr& other)
: m_ptr(other.get())
@@ -87,6 +90,12 @@ public:
return *this;
}
+ RawPtr& operator=(std::nullptr_t)
+ {
+ m_ptr = 0;
+ return *this;
+ }
+
operator T*() const { return m_ptr; }
T& operator*() const { return *m_ptr; }
T* operator->() const { return m_ptr; }
« no previous file with comments | « Source/wtf/PassRefPtr.h ('k') | Source/wtf/RefPtr.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698