QSharedPointer: add move construction, assignment from compatible shared pointers
Change-Id: I772c568055c9bed6eb627ad35dba300925fc0fde Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>bb10
parent
a1ef018d9c
commit
46c5b86612
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Reference in New Issue