summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2016-08-16 09:45:09 +0200
committerMarc Mutz <marc.mutz@kdab.com>2016-08-17 08:59:06 +0000
commit253d2e5135c83730eb1872c6da87116789307d72 (patch)
tree3d5cf6677cfe86b5ac739851108de690e9e78b8f
parente6f5a7d6c03366d773dfa29ce4c119d7ab941ac4 (diff)
QLinkedList: restore move special member functions for iterators
They were masked by the pointless user-defined copy special member functions, which we cannot remove because it would change the way the iterators are passed by value into functions, on some platforms. Add a reminder for Qt 6 to fix the issue for good. Change-Id: I039093894db4a4e5e4bbf94fb346fd90311316c0 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
-rw-r--r--src/corelib/tools/qlinkedlist.h16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/corelib/tools/qlinkedlist.h b/src/corelib/tools/qlinkedlist.h
index e3eed9184f..62cb17c053 100644
--- a/src/corelib/tools/qlinkedlist.h
+++ b/src/corelib/tools/qlinkedlist.h
@@ -136,8 +136,12 @@ public:
Node *i;
inline iterator() : i(0) {}
inline iterator(Node *n) : i(n) {}
- inline iterator(const iterator &o) : i(o.i) {}
- inline iterator &operator=(const iterator &o) { i = o.i; return *this; }
+#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
+ iterator(const iterator &other) Q_DECL_NOTHROW : i(other.i) {}
+ iterator &operator=(const iterator &other) Q_DECL_NOTHROW { i = other.i; return *this; }
+ iterator(iterator &&other) Q_DECL_NOTHROW : i(other.i) {}
+ iterator &operator=(iterator &&other) Q_DECL_NOTHROW { return *this = other; }
+#endif
inline T &operator*() const { return i->t; }
inline T *operator->() const { return &i->t; }
inline bool operator==(const iterator &o) const { return i == o.i; }
@@ -169,9 +173,13 @@ public:
Node *i;
inline const_iterator() : i(0) {}
inline const_iterator(Node *n) : i(n) {}
- inline const_iterator(const const_iterator &o) : i(o.i){}
inline const_iterator(iterator ci) : i(ci.i){}
- inline const_iterator &operator=(const const_iterator &o) { i = o.i; return *this; }
+#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
+ const_iterator(const const_iterator &other) Q_DECL_NOTHROW : i(other.i) {}
+ const_iterator &operator=(const const_iterator &other) Q_DECL_NOTHROW { i = other.i; return *this; }
+ const_iterator(const_iterator &&other) Q_DECL_NOTHROW : i(other.i) {}
+ const_iterator &operator=(const_iterator &&other) Q_DECL_NOTHROW { return *this = other; }
+#endif
inline const T &operator*() const { return i->t; }
inline const T *operator->() const { return &i->t; }
inline bool operator==(const const_iterator &o) const { return i == o.i; }