Index: core/fxcrt/cfx_weak_ptr.h |
diff --git a/core/fxcrt/cfx_weak_ptr.h b/core/fxcrt/cfx_weak_ptr.h |
index 9ac1475884d0f0f9b7194f118d4845e38fd25dbd..f679696992b93bd4fe0f72fb8821c50e4d3f071c 100644 |
--- a/core/fxcrt/cfx_weak_ptr.h |
+++ b/core/fxcrt/cfx_weak_ptr.h |
@@ -7,6 +7,7 @@ |
#ifndef CORE_FXCRT_CFX_WEAK_PTR_H_ |
#define CORE_FXCRT_CFX_WEAK_PTR_H_ |
+#include <cstddef> |
#include <memory> |
#include "core/fxcrt/cfx_retain_ptr.h" |
@@ -21,6 +22,9 @@ class CFX_WeakPtr { |
CFX_WeakPtr(std::unique_ptr<T, D> pObj) |
: m_pHandle(new Handle(std::move(pObj))) {} |
+ // Deliberately implicit to allow passing nullptr. |
+ CFX_WeakPtr(std::nullptr_t arg) {} |
+ |
explicit operator bool() const { return m_pHandle && !!m_pHandle->Get(); } |
bool HasOneRef() const { return m_pHandle && m_pHandle->HasOneRef(); } |
T* operator->() { return m_pHandle->Get(); } |