diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2015-07-03 13:24:31 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2015-07-19 10:33:39 +0000 |
commit | 27ba0b8f88c32b800270b13672fc2260f8d2d28f (patch) | |
tree | 159ee7d1203851e70b8879816902d65f43d965d5 /src/corelib/tools/qlinkedlist.h | |
parent | 8ab2d86d054766bbea0f2e40b6c5d703fdf4ad3b (diff) |
Containers: destroy previous state on move-assignment immediately
[ChangeLog][QtCore] All generic containers (with the exception of
QVarLengthArray, but including QSharedPointer) destroy the
previous state as part of a move-assignment now. Previously, they
would dump it into the right-hand-side object. Note that this is
only true for the generic containers. Other implicitly-shared
types, as well as the non-generic containers QString, QByteArray,
etc. still just swap the contents with the right-hand-side object
when move-assigned into, and, for performance reasons, this will
not change in the forseeable future.
Change-Id: I1f1c684e85400b77bd2e7fba65bde2dce6c1bdde
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools/qlinkedlist.h')
-rw-r--r-- | src/corelib/tools/qlinkedlist.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/tools/qlinkedlist.h b/src/corelib/tools/qlinkedlist.h index 7908bf5137..f216aa121c 100644 --- a/src/corelib/tools/qlinkedlist.h +++ b/src/corelib/tools/qlinkedlist.h @@ -88,7 +88,7 @@ public: #ifdef Q_COMPILER_RVALUE_REFS inline QLinkedList(QLinkedList<T> &&other) : d(other.d) { other.d = const_cast<QLinkedListData *>(&QLinkedListData::shared_null); } inline QLinkedList<T> &operator=(QLinkedList<T> &&other) - { qSwap(d, other.d); return *this; } + { QLinkedList moved(std::move(other)); swap(moved); return *this; } #endif inline void swap(QLinkedList<T> &other) { qSwap(d, other.d); } bool operator==(const QLinkedList<T> &l) const; |