From 253d2e5135c83730eb1872c6da87116789307d72 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 16 Aug 2016 09:45:09 +0200 Subject: 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) Reviewed-by: Thiago Macieira --- src/corelib/tools/qlinkedlist.h | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/corelib/tools') 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; } -- cgit v1.2.3