From 405ac0f09e1622d7ff3cf60314d290851ac9f7fd Mon Sep 17 00:00:00 2001 From: tsepez Date: Mon, 28 Nov 2016 13:59:14 -0800 Subject: Use CFX_MaybeOwned<> in fpdf_edit_create.cpp Fix missing second template parameter in cfx_maybe_owned.h Review-Url: https://codereview.chromium.org/2522313002 --- core/fxcrt/cfx_maybe_owned.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'core/fxcrt/cfx_maybe_owned.h') diff --git a/core/fxcrt/cfx_maybe_owned.h b/core/fxcrt/cfx_maybe_owned.h index 76bd580e28..92b1c1c242 100644 --- a/core/fxcrt/cfx_maybe_owned.h +++ b/core/fxcrt/cfx_maybe_owned.h @@ -21,7 +21,7 @@ class CFX_MaybeOwned { public: CFX_MaybeOwned() : m_pObj(nullptr) {} explicit CFX_MaybeOwned(T* ptr) : m_pObj(ptr) {} - explicit CFX_MaybeOwned(std::unique_ptr ptr) + explicit CFX_MaybeOwned(std::unique_ptr ptr) : m_pOwnedObj(std::move(ptr)), m_pObj(m_pOwnedObj.get()) {} CFX_MaybeOwned(const CFX_MaybeOwned& that) = delete; @@ -30,7 +30,7 @@ class CFX_MaybeOwned { that.m_pObj = nullptr; } - void Reset(std::unique_ptr ptr) { + void Reset(std::unique_ptr ptr) { m_pOwnedObj = std::move(ptr); m_pObj = m_pOwnedObj.get(); } @@ -41,7 +41,7 @@ class CFX_MaybeOwned { bool IsOwned() const { return !!m_pOwnedObj; } T* Get() const { return m_pObj; } - std::unique_ptr Release() { + std::unique_ptr Release() { ASSERT(IsOwned()); return std::move(m_pOwnedObj); } @@ -57,7 +57,7 @@ class CFX_MaybeOwned { Reset(ptr); return *this; } - CFX_MaybeOwned& operator=(std::unique_ptr ptr) { + CFX_MaybeOwned& operator=(std::unique_ptr ptr) { Reset(std::move(ptr)); return *this; } @@ -65,13 +65,13 @@ class CFX_MaybeOwned { bool operator==(const CFX_MaybeOwned& that) const { return Get() == that.Get(); } - bool operator==(const std::unique_ptr& ptr) const { + bool operator==(const std::unique_ptr& ptr) const { return Get() == ptr.get(); } bool operator==(T* ptr) const { return Get() == ptr; } bool operator!=(const CFX_MaybeOwned& that) const { return !(*this == that); } - bool operator!=(const std::unique_ptr ptr) const { + bool operator!=(const std::unique_ptr ptr) const { return !(*this == ptr); } bool operator!=(T* ptr) const { return !(*this == ptr); } -- cgit v1.2.3