QItemSelectionRange: make nothrow move-assignable and -constructible

The move special members were inhibited by the presence of
a user-defined copy ctor, which we cannot remove since the
class is exported.

Change-Id: I7118588b808387f2733d93216c8c3b117666bb9e
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
bb10
Marc Mutz 2015-07-20 01:33:15 +02:00
parent 562c01d04e
commit 4cbc19d3dc
1 changed files with 11 additions and 0 deletions

View File

@ -49,8 +49,19 @@ class Q_CORE_EXPORT QItemSelectionRange
public:
inline QItemSelectionRange() : tl(), br() {}
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
// ### Qt 6: remove them all, the compiler-generated ones are fine
inline QItemSelectionRange(const QItemSelectionRange &other)
: tl(other.tl), br(other.br) {}
# ifdef Q_COMPILER_RVALUE_REFS
QItemSelectionRange(QItemSelectionRange &&other) Q_DECL_NOTHROW
: tl(std::move(other.tl)), br(std::move(other.br)) {}
QItemSelectionRange &operator=(QItemSelectionRange &&other) Q_DECL_NOTHROW
{ tl = std::move(other.tl); br = std::move(other.br); return *this; }
# endif
QItemSelectionRange &operator=(const QItemSelectionRange &other)
{ tl = other.tl; br = other.br; return *this; }
#endif // Qt < 6
QItemSelectionRange(const QModelIndex &topL, const QModelIndex &bottomR) : tl(topL), br(bottomR) {}
explicit QItemSelectionRange(const QModelIndex &index) : tl(index), br(tl) {}