summaryrefslogtreecommitdiff
path: root/core/fxcrt/maybe_owned.h
diff options
context:
space:
mode:
Diffstat (limited to 'core/fxcrt/maybe_owned.h')
-rw-r--r--core/fxcrt/maybe_owned.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/core/fxcrt/maybe_owned.h b/core/fxcrt/maybe_owned.h
index d920ea7a91..ac3a81d47e 100644
--- a/core/fxcrt/maybe_owned.h
+++ b/core/fxcrt/maybe_owned.h
@@ -24,6 +24,7 @@ class MaybeOwned {
public:
MaybeOwned() : m_pObj(nullptr) {}
explicit MaybeOwned(T* ptr) : m_pObj(ptr) {}
+ explicit MaybeOwned(const UnownedPtr<T>& ptr) : m_pObj(ptr.Get()) {}
explicit MaybeOwned(std::unique_ptr<T, D> ptr)
: m_pOwnedObj(std::move(ptr)), m_pObj(m_pOwnedObj.get()) {}
@@ -74,6 +75,10 @@ class MaybeOwned {
Reset(ptr);
return *this;
}
+ MaybeOwned& operator=(const UnownedPtr<T>& ptr) {
+ Reset(ptr.Get());
+ return *this;
+ }
MaybeOwned& operator=(std::unique_ptr<T, D> ptr) {
Reset(std::move(ptr));
return *this;