From cf7ac195266fe05f7548c531df32c2b4aa4b5608 Mon Sep 17 00:00:00 2001 From: tsepez Date: Thu, 8 Sep 2016 15:47:46 -0700 Subject: explicit operator bool for CFX_RetainPtr and CFX_CountRef Review-Url: https://codereview.chromium.org/2324733003 --- core/fxcrt/include/cfx_count_ref.h | 2 +- core/fxcrt/include/cfx_retain_ptr.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'core/fxcrt/include') diff --git a/core/fxcrt/include/cfx_count_ref.h b/core/fxcrt/include/cfx_count_ref.h index 95132a73ca..d709efb67c 100644 --- a/core/fxcrt/include/cfx_count_ref.h +++ b/core/fxcrt/include/cfx_count_ref.h @@ -47,7 +47,7 @@ class CFX_CountRef { return m_pObject == that.m_pObject; } bool operator!=(const CFX_CountRef& that) const { return !(*this == that); } - operator bool() const { return m_pObject; } + explicit operator bool() const { return !!m_pObject; } private: class CountedObj : public ObjClass { diff --git a/core/fxcrt/include/cfx_retain_ptr.h b/core/fxcrt/include/cfx_retain_ptr.h index 25edd585cb..e40feb6b31 100644 --- a/core/fxcrt/include/cfx_retain_ptr.h +++ b/core/fxcrt/include/cfx_retain_ptr.h @@ -46,7 +46,7 @@ class CFX_RetainPtr { bool operator!=(const CFX_RetainPtr& that) const { return !(*this == that); } - operator bool() const { return !!m_pObj; } + explicit operator bool() const { return !!m_pObj; } T& operator*() const { return *m_pObj.get(); } T* operator->() const { return m_pObj.get(); } -- cgit v1.2.3