QSharedPointer: add move construction, assignment from compatible shared pointers

Change-Id: I772c568055c9bed6eb627ad35dba300925fc0fde
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
bb10
Marc Mutz 2015-06-27 13:42:13 +02:00
parent a1ef018d9c
commit 46c5b86612
1 changed files with 17 additions and 0 deletions

View File

@ -336,6 +336,23 @@ public:
swap(moved);
return *this;
}
template <class X>
QSharedPointer(QSharedPointer<X> &&other) Q_DECL_NOTHROW
: value(other.value), d(other.d)
{
other.d = Q_NULLPTR;
other.value = Q_NULLPTR;
}
template <class X>
QSharedPointer &operator=(QSharedPointer<X> &&other) Q_DECL_NOTHROW
{
QSharedPointer moved(std::move(other));
swap(moved);
return *this;
}
#endif
template <class X>