diff --git a/include/vcl/vclptr.hxx b/include/vcl/vclptr.hxx index b4ef55325cfe..f56e006d58e4 100644 --- a/include/vcl/vclptr.hxx +++ b/include/vcl/vclptr.hxx @@ -101,6 +101,13 @@ public: : m_rInnerRef (handle.m_rInnerRef) {} + /** Move constructor... + */ + inline VclPtr (VclPtr && handle) + : m_rInnerRef ( std::move(handle.m_rInnerRef) ) + { + } + /** Up-casting conversion constructor: Copies interface reference. Does not work for up-casts to ambiguous bases. For the special case of @@ -157,7 +164,7 @@ public: m_rInnerRef.set(pBody); } - /** Up-casting assignment operator. + /** Up-casting copy assignment operator. Does not work for up-casts to ambiguous bases. @@ -173,6 +180,22 @@ public: return *this; } + /** move assignment operator. + */ + VclPtr & operator =(VclPtr && rRef) + { + m_rInnerRef = std::move(rRef); + return *this; + } + + /** copy assignment operator. + */ + VclPtr & operator =(const VclPtr & rRef) + { + m_rInnerRef = rRef; + return *this; + } + VclPtr & operator =(reference_type * pBody) { m_rInnerRef.set(pBody); @@ -323,7 +346,7 @@ public: /** Assignment that releases the last reference. */ - inline ScopedVclPtr& operator= (reference_type * pBody) + inline ScopedVclPtr& operator = (reference_type * pBody) { disposeAndReset(pBody); return *this; @@ -361,7 +384,7 @@ private: // Most likely we don't want this default copy-construtor. ScopedVclPtr (const ScopedVclPtr &) = delete; // And certainly we don't want a default assignment operator. - ScopedVclPtr& operator= (const ScopedVclPtr &) = delete; + ScopedVclPtr& operator = (const ScopedVclPtr &) = delete; // And disallow reset as that doesn't call disposeAndClear on the original reference void reset() = delete; void reset(reference_type *pBody) = delete;