diff options
author | tsepez <tsepez@chromium.org> | 2016-11-28 13:59:14 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-11-28 13:59:14 -0800 |
commit | 405ac0f09e1622d7ff3cf60314d290851ac9f7fd (patch) | |
tree | b4fc6bddcbdde7ff3f709be189c8caaca8252af1 /core/fxcrt | |
parent | 3c0f366daafed42495b22ecbdda8f21f3f939d9b (diff) | |
download | pdfium-405ac0f09e1622d7ff3cf60314d290851ac9f7fd.tar.xz |
Use CFX_MaybeOwned<> in fpdf_edit_create.cppchromium/2936
Fix missing second template parameter in cfx_maybe_owned.h
Review-Url: https://codereview.chromium.org/2522313002
Diffstat (limited to 'core/fxcrt')
-rw-r--r-- | core/fxcrt/cfx_maybe_owned.h | 12 |
1 files changed, 6 insertions, 6 deletions
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<T> ptr) + explicit CFX_MaybeOwned(std::unique_ptr<T, D> 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<T> ptr) { + void Reset(std::unique_ptr<T, D> 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<T> Release() { + std::unique_ptr<T, D> 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<T> ptr) { + CFX_MaybeOwned& operator=(std::unique_ptr<T, D> 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<T>& ptr) const { + bool operator==(const std::unique_ptr<T, D>& 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<T> ptr) const { + bool operator!=(const std::unique_ptr<T, D> ptr) const { return !(*this == ptr); } bool operator!=(T* ptr) const { return !(*this == ptr); } |