diff options
Diffstat (limited to 'core/fxcrt')
-rw-r--r-- | core/fxcrt/cfx_weak_ptr.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/core/fxcrt/cfx_weak_ptr.h b/core/fxcrt/cfx_weak_ptr.h index 9ac1475884..f679696992 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(); } |