summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2015-06-27 13:42:13 +0200
committerMarc Mutz <marc.mutz@kdab.com>2015-07-19 10:33:50 +0000
commit46c5b8661222e86dca9363b14a84b46f959149a8 (patch)
tree3d68095a1628215a19c5d47384bca4ec7fcac2d7
parenta1ef018d9c99a5ce732dda4af93be493826c996b (diff)
QSharedPointer: add move construction, assignment from compatible shared pointers
Change-Id: I772c568055c9bed6eb627ad35dba300925fc0fde Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
-rw-r--r--src/corelib/tools/qsharedpointer_impl.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h
index 80b1501d1c..b1434b530e 100644
--- a/src/corelib/tools/qsharedpointer_impl.h
+++ b/src/corelib/tools/qsharedpointer_impl.h
@@ -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>