add move operators for VclPtr

Change-Id: Ic32894d13aac2d8038afec2efebcc544f1c408af
Reviewed-on: https://gerrit.libreoffice.org/30748
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2016-11-10 12:05:09 +02:00
parent c64b8ffe85
commit 071e23fee0

View File

@@ -101,6 +101,13 @@ public:
: m_rInnerRef (handle.m_rInnerRef)
{}
/** Move constructor...
*/
inline VclPtr (VclPtr<reference_type> && 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<reference_type> && rRef)
{
m_rInnerRef = std::move(rRef);
return *this;
}
/** copy assignment operator.
*/
VclPtr & operator =(const VclPtr<reference_type> & rRef)
{
m_rInnerRef = rRef;
return *this;
}
VclPtr & operator =(reference_type * pBody)
{
m_rInnerRef.set(pBody);