Centralize the implementation of move assignment operators

At the moment we have two main strategies for dealing with move
assignment in Qt:

1) move-and-swap, used by "containers" (in the broad sense): containers,
but also smart pointers and similar classes that can hold user-defined
types;

2) pure swap, used by containers that hold only memory (e.g. QString,
QByteArray, ...) as well as most implicitly shared datatypes.

Given the fact that a move assignment operator's code is just
boilerplate (whether it's move-and-swap or pure swap), provide two
_strictly internal_ macros to help write them, and apply the macros
across corelib and gui, porting away from the hand-rolled
implementations.

The rule of thumb when porting to the new macros is:

* Try to stick to the existing code behavior, unless broken

* if changing, then follow this checklist:

  * if the class does not have a move constructor => pure swap
    (but consider ADDING a move constructor, if possible!)

  * if the class does have a move constructor, try to follow the
     criteria above, namely:

    * if the class holds only memory, pure swap;

    * if the class may hold anything else but memory (file handles,
      etc.), then move and swap.

Noteworthy details:

* some operators planned to be removed in Qt 6 were not ported;

* as drive-by, some move constructors were simplified to be using
qExchange(); others were outright broken and got fixed;

* some contained some more interesting code and were not touched.

Change-Id: Idaab3489247dcbabb6df3fa1e5286b69e1d372e9
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
This commit is contained in:
Giuseppe D'Angelo 2020-01-03 17:18:02 +01:00
parent 990e2e4fb8
commit 889d40ebe2
59 changed files with 148 additions and 189 deletions

View File

@ -431,6 +431,51 @@ Q_DECL_UNUSED constexpr Deprecated_t Deprecated = {};
Q_DISABLE_COPY(Class) \ Q_DISABLE_COPY(Class) \
Q_DISABLE_MOVE(Class) Q_DISABLE_MOVE(Class)
/*
Implementing a move assignment operator using an established
technique (move-and-swap, pure swap) is just boilerplate.
Here's a couple of *private* macros for convenience.
To know which one to use:
* if you don't have a move constructor (*) => use pure swap;
* if you have a move constructor, then
* if your class holds just memory (no file handles, no user-defined
datatypes, etc.) => use pure swap;
* use move and swap.
The preference should always go for the move-and-swap one, as it
will deterministically destroy the data previously held in *this,
and not "dump" it in the moved-from object (which may then be alive
for longer).
The requirement for either macro is the presence of a member swap(),
which any value class that defines its own special member functions
should have anyhow.
(*) Many value classes in Qt do not have move constructors; mostly,
the implicitly shared classes using QSharedDataPointer and friends.
The reason is mostly historical: those classes require either an
out-of-line move constructor, which we could not provide before we
made C++11 mandatory (and that we don't like anyhow), or
an out-of-line dtor for the Q(E)DSP<Private> member (cf. QPixmap).
If you can however add a move constructor to a class lacking it,
consider doing so, then reevaluate which macro to choose.
*/
#define QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(Class) \
Class &operator=(Class &&other) noexcept { \
Class moved(std::move(other)); \
swap(moved); \
return *this; \
}
#define QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(Class) \
Class &operator=(Class &&other) noexcept { \
swap(other); \
return *this; \
}
/* /*
No, this is not an evil backdoor. QT_BUILD_INTERNAL just exports more symbols No, this is not an evil backdoor. QT_BUILD_INTERNAL just exports more symbols
for Qt's internal unit tests. If you want slower loading times and more for Qt's internal unit tests. If you want slower loading times and more

View File

@ -102,8 +102,7 @@ public:
QDebug(const QDebug &o) : stream(o.stream) { ++stream->ref; } QDebug(const QDebug &o) : stream(o.stream) { ++stream->ref; }
QDebug(QDebug &&other) noexcept : stream{qExchange(other.stream, nullptr)} {} QDebug(QDebug &&other) noexcept : stream{qExchange(other.stream, nullptr)} {}
inline QDebug &operator=(const QDebug &other); inline QDebug &operator=(const QDebug &other);
QDebug &operator=(QDebug &&other) noexcept QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QDebug)
{ QDebug{std::move(other)}.swap(*this); return *this; }
~QDebug(); ~QDebug();
inline void swap(QDebug &other) noexcept { qSwap(stream, other.stream); } inline void swap(QDebug &other) noexcept { qSwap(stream, other.stream); }

View File

@ -121,7 +121,7 @@ public:
~QDir(); ~QDir();
QDir &operator=(const QDir &); QDir &operator=(const QDir &);
QDir &operator=(QDir &&other) noexcept { swap(other); return *this; } QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QDir)
void swap(QDir &other) noexcept void swap(QDir &other) noexcept
{ qSwap(d_ptr, other.d_ptr); } { qSwap(d_ptr, other.d_ptr); }

View File

@ -79,7 +79,7 @@ public:
~QFileInfo(); ~QFileInfo();
QFileInfo &operator=(const QFileInfo &fileinfo); QFileInfo &operator=(const QFileInfo &fileinfo);
QFileInfo &operator=(QFileInfo &&other) noexcept { swap(other); return *this; } QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QFileInfo)
void swap(QFileInfo &other) noexcept void swap(QFileInfo &other) noexcept
{ qSwap(d_ptr, other.d_ptr); } { qSwap(d_ptr, other.d_ptr); }

View File

@ -68,7 +68,7 @@ public:
QProcessEnvironment(); QProcessEnvironment();
QProcessEnvironment(const QProcessEnvironment &other); QProcessEnvironment(const QProcessEnvironment &other);
~QProcessEnvironment(); ~QProcessEnvironment();
QProcessEnvironment &operator=(QProcessEnvironment && other) noexcept { swap(other); return *this; } QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QProcessEnvironment)
QProcessEnvironment &operator=(const QProcessEnvironment &other); QProcessEnvironment &operator=(const QProcessEnvironment &other);
void swap(QProcessEnvironment &other) noexcept { qSwap(d, other.d); } void swap(QProcessEnvironment &other) noexcept { qSwap(d, other.d); }

View File

@ -62,7 +62,7 @@ public:
~QStorageInfo(); ~QStorageInfo();
QStorageInfo &operator=(const QStorageInfo &other); QStorageInfo &operator=(const QStorageInfo &other);
QStorageInfo &operator=(QStorageInfo &&other) noexcept { swap(other); return *this; } QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QStorageInfo)
inline void swap(QStorageInfo &other) noexcept inline void swap(QStorageInfo &other) noexcept
{ qSwap(d, other.d); } { qSwap(d, other.d); }

View File

@ -184,8 +184,7 @@ public:
#endif #endif
QUrl(QUrl &&other) noexcept : d(other.d) QUrl(QUrl &&other) noexcept : d(other.d)
{ other.d = nullptr; } { other.d = nullptr; }
inline QUrl &operator=(QUrl &&other) noexcept QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QUrl)
{ qSwap(d, other.d); return *this; }
~QUrl(); ~QUrl();
inline void swap(QUrl &other) noexcept { qSwap(d, other.d); } inline void swap(QUrl &other) noexcept { qSwap(d, other.d); }

View File

@ -67,7 +67,7 @@ public:
QUrlQuery(const QUrlQuery &other); QUrlQuery(const QUrlQuery &other);
QUrlQuery &operator=(const QUrlQuery &other); QUrlQuery &operator=(const QUrlQuery &other);
QUrlQuery &operator=(QUrlQuery &&other) noexcept { swap(other); return *this; } QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QUrlQuery)
~QUrlQuery(); ~QUrlQuery();
bool operator==(const QUrlQuery &other) const; bool operator==(const QUrlQuery &other) const;

View File

@ -220,9 +220,8 @@ public:
{ return !operator==(other); } { return !operator==(other); }
QPersistentModelIndex &operator=(const QPersistentModelIndex &other); QPersistentModelIndex &operator=(const QPersistentModelIndex &other);
inline QPersistentModelIndex(QPersistentModelIndex &&other) noexcept inline QPersistentModelIndex(QPersistentModelIndex &&other) noexcept
: d(other.d) { other.d = nullptr; } : d(qExchange(other.d, nullptr)) {}
inline QPersistentModelIndex &operator=(QPersistentModelIndex &&other) noexcept QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QPersistentModelIndex)
{ qSwap(d, other.d); return *this; }
inline void swap(QPersistentModelIndex &other) noexcept { qSwap(d, other.d); } inline void swap(QPersistentModelIndex &other) noexcept { qSwap(d, other.d); }
bool operator==(const QModelIndex &other) const; bool operator==(const QModelIndex &other) const;
bool operator!=(const QModelIndex &other) const; bool operator!=(const QModelIndex &other) const;

View File

@ -61,11 +61,7 @@ public:
: id{qExchange(other.id, 0)} : id{qExchange(other.id, 0)}
{} {}
QBasicTimer& operator=(QBasicTimer &&other) noexcept QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QBasicTimer)
{
QBasicTimer{std::move(other)}.swap(*this);
return *this;
}
void swap(QBasicTimer &other) noexcept { qSwap(id, other.id); } void swap(QBasicTimer &other) noexcept { qSwap(id, other.id); }

View File

@ -260,21 +260,12 @@ public:
QAppleLogActivity(os_activity_t activity) : activity(activity) {} QAppleLogActivity(os_activity_t activity) : activity(activity) {}
~QAppleLogActivity() { if (activity) leave(); } ~QAppleLogActivity() { if (activity) leave(); }
QAppleLogActivity(const QAppleLogActivity &) = delete; Q_DISABLE_COPY(QAppleLogActivity)
QAppleLogActivity& operator=(const QAppleLogActivity &) = delete;
QAppleLogActivity(QAppleLogActivity&& other) QAppleLogActivity(QAppleLogActivity&& other)
: activity(other.activity), state(other.state) { other.activity = nullptr; } : activity(qExchange(other.activity, nullptr)), state(other.state) {}
QAppleLogActivity& operator=(QAppleLogActivity &&other) QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QAppleLogActivity)
{
if (this != &other) {
activity = other.activity;
state = other.state;
other.activity = nullptr;
}
return *this;
}
QAppleLogActivity&& enter() QAppleLogActivity&& enter()
{ {
@ -343,18 +334,14 @@ public:
#endif #endif
QMacNotificationObserver(const QMacNotificationObserver& other) = delete; QMacNotificationObserver(const QMacNotificationObserver& other) = delete;
QMacNotificationObserver(QMacNotificationObserver&& other) : observer(other.observer) { QMacNotificationObserver(QMacNotificationObserver&& other) : observer(qExchange(other.observer, nullptr)) {}
other.observer = nullptr;
}
QMacNotificationObserver &operator=(const QMacNotificationObserver& other) = delete; QMacNotificationObserver &operator=(const QMacNotificationObserver& other) = delete;
QMacNotificationObserver &operator=(QMacNotificationObserver&& other) { QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QMacNotificationObserver)
if (this != &other) {
remove(); void swap(QMacNotificationObserver &other) noexcept
observer = other.observer; {
other.observer = nullptr; qSwap(observer, other.observer);
}
return *this;
} }
void remove(); void remove();
@ -397,11 +384,7 @@ public:
return *this; return *this;
} }
QMacKeyValueObserver &operator=(QMacKeyValueObserver &&other) { QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QMacKeyValueObserver)
QMacKeyValueObserver tmp(std::move(other));
swap(tmp, *this);
return *this;
}
void removeObserver(); void removeObserver();

View File

@ -1597,6 +1597,14 @@ bool QMetaObject::invokeMethodImpl(QObject *object, QtPrivate::QSlotObjectBase *
that \a o was pointing to. that \a o was pointing to.
*/ */
/*!
\fn QMetaObject::Connection::swap(Connection &other)
\since 5.15
Swaps this Connection instance with \a other. This operation is very fast
and never fails.
*/
/*! /*!
\class QMetaMethod \class QMetaMethod
\inmodule QtCore \inmodule QtCore

View File

@ -459,11 +459,16 @@ public:
operator RestrictedBool() const { return d_ptr && isConnected_helper() ? &Connection::d_ptr : nullptr; } operator RestrictedBool() const { return d_ptr && isConnected_helper() ? &Connection::d_ptr : nullptr; }
#endif #endif
Connection(Connection &&o) noexcept : d_ptr(o.d_ptr) { o.d_ptr = nullptr; } Connection(Connection &&o) noexcept : d_ptr(qExchange(o.d_ptr, nullptr)) {}
Connection &operator=(Connection &&other) noexcept QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(Connection)
{ qSwap(d_ptr, other.d_ptr); return *this; } void swap(Connection &o) noexcept { qSwap(d_ptr, o.d_ptr); }
}; };
inline void swap(QMetaObject::Connection &lhs, QMetaObject::Connection &rhs) noexcept
{
lhs.swap(rhs);
}
inline const QMetaObject *QMetaObject::superClass() const inline const QMetaObject *QMetaObject::superClass() const
{ return d.superdata; } { return d.superdata; }

View File

@ -234,8 +234,7 @@ class Q_CORE_EXPORT QVariant
QVariant& operator=(const QVariant &other); QVariant& operator=(const QVariant &other);
inline QVariant(QVariant &&other) noexcept : d(other.d) inline QVariant(QVariant &&other) noexcept : d(other.d)
{ other.d = Private(); } { other.d = Private(); }
inline QVariant &operator=(QVariant &&other) noexcept QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QVariant)
{ QVariant moved(std::move(other)); swap(moved); return *this; }
inline void swap(QVariant &other) noexcept { qSwap(d, other.d); } inline void swap(QVariant &other) noexcept { qSwap(d, other.d); }

View File

@ -68,9 +68,9 @@ public:
REGSAM permissions = KEY_READ, REGSAM access = 0); REGSAM permissions = KEY_READ, REGSAM access = 0);
~QWinRegistryKey(); ~QWinRegistryKey();
QWinRegistryKey(QWinRegistryKey &&other) noexcept { swap(other); } QWinRegistryKey(QWinRegistryKey &&other) noexcept
QWinRegistryKey &operator=(QWinRegistryKey &&other) noexcept { swap(other); return *this; } : m_key(qExchange(other.m_key, nullptr)) {}
QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QWinRegistryKey)
void swap(QWinRegistryKey &other) noexcept { qSwap(m_key, other.m_key); } void swap(QWinRegistryKey &other) noexcept { qSwap(m_key, other.m_key); }
bool isValid() const { return m_key != nullptr; } bool isValid() const { return m_key != nullptr; }

View File

@ -78,7 +78,7 @@ public:
QMimeType(); QMimeType();
QMimeType(const QMimeType &other); QMimeType(const QMimeType &other);
QMimeType &operator=(const QMimeType &other); QMimeType &operator=(const QMimeType &other);
QMimeType &operator=(QMimeType &&other) noexcept { swap(other); return *this; } QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QMimeType)
void swap(QMimeType &other) noexcept void swap(QMimeType &other) noexcept
{ {
qSwap(d, other.d); qSwap(d, other.d);

View File

@ -185,12 +185,7 @@ public:
other.container = nullptr; other.container = nullptr;
} }
QCborValue &operator=(const QCborValue &other); QCborValue &operator=(const QCborValue &other);
QCborValue &operator=(QCborValue &&other) noexcept QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QCborValue)
{
QCborValue tmp(std::move(other));
swap(tmp);
return *this;
}
void swap(QCborValue &other) noexcept void swap(QCborValue &other) noexcept
{ {

View File

@ -170,8 +170,7 @@ public:
QByteArray &operator=(const char *str); QByteArray &operator=(const char *str);
inline QByteArray(QByteArray && other) noexcept inline QByteArray(QByteArray && other) noexcept
{ qSwap(d, other.d); } { qSwap(d, other.d); }
inline QByteArray &operator=(QByteArray &&other) noexcept QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QByteArray)
{ qSwap(d, other.d); return *this; }
inline void swap(QByteArray &other) noexcept inline void swap(QByteArray &other) noexcept
{ qSwap(d, other.d); } { qSwap(d, other.d); }

View File

@ -57,8 +57,7 @@ public:
QCollatorSortKey(const QCollatorSortKey &other); QCollatorSortKey(const QCollatorSortKey &other);
~QCollatorSortKey(); ~QCollatorSortKey();
QCollatorSortKey &operator=(const QCollatorSortKey &other); QCollatorSortKey &operator=(const QCollatorSortKey &other);
inline QCollatorSortKey &operator=(QCollatorSortKey &&other) noexcept QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QCollatorSortKey)
{ swap(other); return *this; }
void swap(QCollatorSortKey &other) noexcept void swap(QCollatorSortKey &other) noexcept
{ d.swap(other.d); } { d.swap(other.d); }
@ -88,8 +87,7 @@ public:
QCollator &operator=(const QCollator &); QCollator &operator=(const QCollator &);
QCollator(QCollator &&other) noexcept QCollator(QCollator &&other) noexcept
: d(other.d) { other.d = nullptr; } : d(other.d) { other.d = nullptr; }
QCollator &operator=(QCollator &&other) noexcept QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QCollator)
{ swap(other); return *this; }
void swap(QCollator &other) noexcept void swap(QCollator &other) noexcept
{ qSwap(d, other.d); } { qSwap(d, other.d); }

View File

@ -944,7 +944,7 @@ public:
QLocale(Language language, Country country = AnyCountry); QLocale(Language language, Country country = AnyCountry);
QLocale(Language language, Script script, Country country); QLocale(Language language, Script script, Country country);
QLocale(const QLocale &other); QLocale(const QLocale &other);
QLocale &operator=(QLocale &&other) noexcept { swap(other); return *this; } QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QLocale)
QLocale &operator=(const QLocale &other); QLocale &operator=(const QLocale &other);
~QLocale(); ~QLocale();

View File

@ -88,8 +88,7 @@ public:
QRegularExpression(const QRegularExpression &re); QRegularExpression(const QRegularExpression &re);
~QRegularExpression(); ~QRegularExpression();
QRegularExpression &operator=(const QRegularExpression &re); QRegularExpression &operator=(const QRegularExpression &re);
QRegularExpression &operator=(QRegularExpression &&re) noexcept QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QRegularExpression)
{ d.swap(re.d); return *this; }
void swap(QRegularExpression &other) noexcept { d.swap(other.d); } void swap(QRegularExpression &other) noexcept { d.swap(other.d); }

View File

@ -337,8 +337,7 @@ public:
QString &operator=(QLatin1String latin1); QString &operator=(QLatin1String latin1);
inline QString(QString &&other) noexcept inline QString(QString &&other) noexcept
{ qSwap(d, other.d); } { qSwap(d, other.d); }
inline QString &operator=(QString &&other) noexcept QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QString)
{ qSwap(d, other.d); return *this; }
inline void swap(QString &other) noexcept { qSwap(d, other.d); } inline void swap(QString &other) noexcept { qSwap(d, other.d); }
inline qsizetype size() const { return d.size; } inline qsizetype size() const { return d.size; }
inline qsizetype count() const { return d.size; } inline qsizetype count() const { return d.size; }

View File

@ -83,8 +83,7 @@ public:
: m_sem(sem), m_n(n) {} : m_sem(sem), m_n(n) {}
QSemaphoreReleaser(QSemaphoreReleaser &&other) noexcept QSemaphoreReleaser(QSemaphoreReleaser &&other) noexcept
: m_sem(other.cancel()), m_n(other.m_n) {} : m_sem(other.cancel()), m_n(other.m_n) {}
QSemaphoreReleaser &operator=(QSemaphoreReleaser &&other) noexcept QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QSemaphoreReleaser)
{ QSemaphoreReleaser moved(std::move(other)); swap(moved); return *this; }
~QSemaphoreReleaser() ~QSemaphoreReleaser()
{ {

View File

@ -271,7 +271,7 @@ public:
QDateTime(QDateTime &&other) noexcept; QDateTime(QDateTime &&other) noexcept;
~QDateTime(); ~QDateTime();
QDateTime &operator=(QDateTime &&other) noexcept { swap(other); return *this; } QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QDateTime)
QDateTime &operator=(const QDateTime &other) noexcept; QDateTime &operator=(const QDateTime &other) noexcept;
void swap(QDateTime &other) noexcept { qSwap(d.d, other.d.d); } void swap(QDateTime &other) noexcept { qSwap(d.d, other.d.d); }

View File

@ -99,7 +99,7 @@ public:
~QTimeZone(); ~QTimeZone();
QTimeZone &operator=(const QTimeZone &other); QTimeZone &operator=(const QTimeZone &other);
QTimeZone &operator=(QTimeZone &&other) noexcept { swap(other); return *this; } QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QTimeZone)
void swap(QTimeZone &other) noexcept void swap(QTimeZone &other) noexcept
{ d.swap(other.d); } { d.swap(other.d); }

View File

@ -101,12 +101,7 @@ public:
other.size = 0; other.size = 0;
} }
QArrayDataPointer &operator=(QArrayDataPointer &&other) noexcept QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QArrayDataPointer)
{
QArrayDataPointer moved(std::move(other));
swap(moved);
return *this;
}
DataOps &operator*() noexcept DataOps &operator*() noexcept
{ {

View File

@ -61,8 +61,7 @@ public:
QBitArray(const QBitArray &other) : d(other.d) {} QBitArray(const QBitArray &other) : d(other.d) {}
inline QBitArray &operator=(const QBitArray &other) { d = other.d; return *this; } inline QBitArray &operator=(const QBitArray &other) { d = other.d; return *this; }
inline QBitArray(QBitArray &&other) noexcept : d(std::move(other.d)) {} inline QBitArray(QBitArray &&other) noexcept : d(std::move(other.d)) {}
inline QBitArray &operator=(QBitArray &&other) noexcept QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QBitArray)
{ qSwap(d, other.d); return *this; }
inline void swap(QBitArray &other) noexcept { qSwap(d, other.d); } inline void swap(QBitArray &other) noexcept { qSwap(d, other.d); }

View File

@ -72,7 +72,7 @@ public:
~QCommandLineOption(); ~QCommandLineOption();
QCommandLineOption &operator=(const QCommandLineOption &other); QCommandLineOption &operator=(const QCommandLineOption &other);
QCommandLineOption &operator=(QCommandLineOption &&other) noexcept { swap(other); return *this; } QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QCommandLineOption)
void swap(QCommandLineOption &other) noexcept void swap(QCommandLineOption &other) noexcept
{ qSwap(d, other.d); } { qSwap(d, other.d); }

View File

@ -94,8 +94,7 @@ public:
inline bool isDetached() const { return d->ref.loadRelaxed() == 1; } inline bool isDetached() const { return d->ref.loadRelaxed() == 1; }
QContiguousCache<T> &operator=(const QContiguousCache<T> &other); QContiguousCache<T> &operator=(const QContiguousCache<T> &other);
inline QContiguousCache<T> &operator=(QContiguousCache<T> &&other) noexcept QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QContiguousCache)
{ qSwap(d, other.d); return *this; }
inline void swap(QContiguousCache<T> &other) noexcept { qSwap(d, other.d); } inline void swap(QContiguousCache<T> &other) noexcept { qSwap(d, other.d); }
template <typename U = T> template <typename U = T>

View File

@ -80,8 +80,7 @@ public:
QEasingCurve &operator=(const QEasingCurve &other) QEasingCurve &operator=(const QEasingCurve &other)
{ if ( this != &other ) { QEasingCurve copy(other); swap(copy); } return *this; } { if ( this != &other ) { QEasingCurve copy(other); swap(copy); } return *this; }
QEasingCurve(QEasingCurve &&other) noexcept : d_ptr(other.d_ptr) { other.d_ptr = nullptr; } QEasingCurve(QEasingCurve &&other) noexcept : d_ptr(other.d_ptr) { other.d_ptr = nullptr; }
QEasingCurve &operator=(QEasingCurve &&other) noexcept QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QEasingCurve)
{ qSwap(d_ptr, other.d_ptr); return *this; }
void swap(QEasingCurve &other) noexcept { qSwap(d_ptr, other.d_ptr); } void swap(QEasingCurve &other) noexcept { qSwap(d_ptr, other.d_ptr); }

View File

@ -750,15 +750,7 @@ public:
: d(std::exchange(other.d, nullptr)) : d(std::exchange(other.d, nullptr))
{ {
} }
QHash &operator=(QHash &&other) noexcept(std::is_nothrow_destructible<Node>::value) QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QHash)
{
if (d != other.d) {
if (d && !d->ref.deref())
delete d;
d = std::exchange(other.d, nullptr);
}
return *this;
}
#ifdef Q_QDOC #ifdef Q_QDOC
template <typename InputIterator> template <typename InputIterator>
QHash(InputIterator f, InputIterator l); QHash(InputIterator f, InputIterator l);

View File

@ -94,11 +94,7 @@ public:
{ {
other.headOffset = other.tailOffset = 0; other.headOffset = other.tailOffset = 0;
} }
inline QRingChunk &operator=(QRingChunk &&other) noexcept QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QRingChunk)
{
swap(other);
return *this;
}
inline void swap(QRingChunk &other) noexcept inline void swap(QRingChunk &other) noexcept
{ {

View File

@ -111,13 +111,8 @@ public:
} }
return *this; return *this;
} }
QSharedDataPointer(QSharedDataPointer &&o) noexcept : d(o.d) { o.d = nullptr; } QSharedDataPointer(QSharedDataPointer &&o) noexcept : d(qExchange(o.d, nullptr)) {}
inline QSharedDataPointer<T> &operator=(QSharedDataPointer<T> &&other) noexcept QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QSharedDataPointer)
{
QSharedDataPointer moved(std::move(other));
swap(moved);
return *this;
}
inline bool operator!() const { return !d; } inline bool operator!() const { return !d; }
@ -216,13 +211,8 @@ public:
} }
return *this; return *this;
} }
inline QExplicitlySharedDataPointer(QExplicitlySharedDataPointer &&o) noexcept : d(o.d) { o.d = nullptr; } inline QExplicitlySharedDataPointer(QExplicitlySharedDataPointer &&o) noexcept : d(qExchange(o.d, nullptr)) {}
inline QExplicitlySharedDataPointer<T> &operator=(QExplicitlySharedDataPointer<T> &&other) noexcept QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QExplicitlySharedDataPointer)
{
QExplicitlySharedDataPointer moved(std::move(other));
swap(moved);
return *this;
}
inline bool operator!() const { return !d; } inline bool operator!() const { return !d; }

View File

@ -333,12 +333,7 @@ public:
other.d = nullptr; other.d = nullptr;
other.value = nullptr; other.value = nullptr;
} }
QSharedPointer &operator=(QSharedPointer &&other) noexcept QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QSharedPointer)
{
QSharedPointer moved(std::move(other));
swap(moved);
return *this;
}
template <class X, IfCompatible<X> = true> template <class X, IfCompatible<X> = true>
QSharedPointer(QSharedPointer<X> &&other) noexcept QSharedPointer(QSharedPointer<X> &&other) noexcept
@ -563,8 +558,7 @@ public:
other.d = nullptr; other.d = nullptr;
other.value = nullptr; other.value = nullptr;
} }
QWeakPointer &operator=(QWeakPointer &&other) noexcept QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QWeakPointer)
{ QWeakPointer moved(std::move(other)); swap(moved); return *this; }
QWeakPointer &operator=(const QWeakPointer &other) noexcept QWeakPointer &operator=(const QWeakPointer &other) noexcept
{ {
QWeakPointer copy(other); QWeakPointer copy(other);

View File

@ -126,10 +126,11 @@ class QVersionNumber
other.dummy = 1; other.dummy = 1;
} }
SegmentStorage &operator=(SegmentStorage &&other) noexcept QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(SegmentStorage)
void swap(SegmentStorage &other) noexcept
{ {
qSwap(dummy, other.dummy); qSwap(dummy, other.dummy);
return *this;
} }
explicit SegmentStorage(QList<int> &&seg) explicit SegmentStorage(QList<int> &&seg)

View File

@ -62,14 +62,13 @@ public:
QIcon(const QPixmap &pixmap); QIcon(const QPixmap &pixmap);
QIcon(const QIcon &other); QIcon(const QIcon &other);
QIcon(QIcon &&other) noexcept QIcon(QIcon &&other) noexcept
: d(other.d) : d(qExchange(other.d, nullptr))
{ other.d = nullptr; } {}
explicit QIcon(const QString &fileName); // file or resource name explicit QIcon(const QString &fileName); // file or resource name
explicit QIcon(QIconEngine *engine); explicit QIcon(QIconEngine *engine);
~QIcon(); ~QIcon();
QIcon &operator=(const QIcon &other); QIcon &operator=(const QIcon &other);
inline QIcon &operator=(QIcon &&other) noexcept QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QIcon)
{ swap(other); return *this; }
inline void swap(QIcon &other) noexcept inline void swap(QIcon &other) noexcept
{ qSwap(d, other.d); } { qSwap(d, other.d); }
bool operator==(const QIcon &) const = delete; bool operator==(const QIcon &) const = delete;

View File

@ -125,13 +125,12 @@ public:
QImage(const QImage &); QImage(const QImage &);
inline QImage(QImage &&other) noexcept inline QImage(QImage &&other) noexcept
: QPaintDevice(), d(nullptr) : QPaintDevice(), d(qExchange(other.d, nullptr))
{ qSwap(d, other.d); } {}
~QImage(); ~QImage();
QImage &operator=(const QImage &); QImage &operator=(const QImage &);
inline QImage &operator=(QImage &&other) noexcept QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QImage)
{ qSwap(d, other.d); return *this; }
inline void swap(QImage &other) noexcept inline void swap(QImage &other) noexcept
{ qSwap(d, other.d); } { qSwap(d, other.d); }

View File

@ -77,8 +77,7 @@ public:
void setBoundingRect(const QRect &r); void setBoundingRect(const QRect &r);
QPicture& operator=(const QPicture &p); QPicture& operator=(const QPicture &p);
inline QPicture &operator=(QPicture &&other) noexcept QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QPicture)
{ qSwap(d_ptr, other.d_ptr); return *this; }
inline void swap(QPicture &other) noexcept inline void swap(QPicture &other) noexcept
{ d_ptr.swap(other.d_ptr); } { d_ptr.swap(other.d_ptr); }
void detach(); void detach();

View File

@ -75,8 +75,7 @@ public:
~QPixmap(); ~QPixmap();
QPixmap &operator=(const QPixmap &); QPixmap &operator=(const QPixmap &);
inline QPixmap &operator=(QPixmap &&other) noexcept QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QPixmap)
{ qSwap(data, other.data); return *this; }
inline void swap(QPixmap &other) noexcept inline void swap(QPixmap &other) noexcept
{ qSwap(data, other.data); } { qSwap(data, other.data); }
bool operator==(const QPixmap &) const = delete; bool operator==(const QPixmap &) const = delete;

View File

@ -87,9 +87,8 @@ public:
QCursor(const QCursor &cursor); QCursor(const QCursor &cursor);
~QCursor(); ~QCursor();
QCursor &operator=(const QCursor &cursor); QCursor &operator=(const QCursor &cursor);
QCursor(QCursor &&other) noexcept : d(other.d) { other.d = nullptr; } QCursor(QCursor &&other) noexcept : d(qExchange(other.d, nullptr)) {}
inline QCursor &operator=(QCursor &&other) noexcept QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QCursor)
{ swap(other); return *this; }
void swap(QCursor &other) noexcept { qSwap(d, other.d); } void swap(QCursor &other) noexcept { qSwap(d, other.d); }

View File

@ -185,7 +185,7 @@ public:
operator QVariant() const; operator QVariant() const;
QKeyCombination operator[](uint i) const; QKeyCombination operator[](uint i) const;
QKeySequence &operator=(const QKeySequence &other); QKeySequence &operator=(const QKeySequence &other);
QKeySequence &operator=(QKeySequence &&other) noexcept { swap(other); return *this; } QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QKeySequence)
void swap(QKeySequence &other) noexcept { qSwap(d, other.d); } void swap(QKeySequence &other) noexcept { qSwap(d, other.d); }
bool operator==(const QKeySequence &other) const; bool operator==(const QKeySequence &other) const;

View File

@ -68,12 +68,9 @@ public:
~QPalette(); ~QPalette();
QPalette &operator=(const QPalette &palette); QPalette &operator=(const QPalette &palette);
QPalette(QPalette &&other) noexcept QPalette(QPalette &&other) noexcept
: d(other.d), data(other.data) : d(qExchange(other.d, nullptr)), data(other.data)
{ other.d = nullptr; } {}
inline QPalette &operator=(QPalette &&other) noexcept QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QPalette)
{
swap(other); return *this;
}
void swap(QPalette &other) noexcept void swap(QPalette &other) noexcept
{ {

View File

@ -78,8 +78,7 @@ public:
~QBrush(); ~QBrush();
QBrush &operator=(const QBrush &brush); QBrush &operator=(const QBrush &brush);
inline QBrush &operator=(QBrush &&other) noexcept QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QBrush)
{ qSwap(d, other.d); return *this; }
inline void swap(QBrush &other) noexcept inline void swap(QBrush &other) noexcept
{ qSwap(d, other.d); } { qSwap(d, other.d); }

View File

@ -95,12 +95,7 @@ public:
QColorSpace(QColorSpace &&colorSpace) noexcept QColorSpace(QColorSpace &&colorSpace) noexcept
: d_ptr(qExchange(colorSpace.d_ptr, nullptr)) : d_ptr(qExchange(colorSpace.d_ptr, nullptr))
{ } { }
QColorSpace &operator=(QColorSpace &&colorSpace) noexcept QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QColorSpace)
{
// Make the deallocation of this->d_ptr happen in ~QColorSpace()
QColorSpace(std::move(colorSpace)).swap(*this);
return *this;
}
void swap(QColorSpace &colorSpace) noexcept void swap(QColorSpace &colorSpace) noexcept
{ qSwap(d_ptr, colorSpace.d_ptr); } { qSwap(d_ptr, colorSpace.d_ptr); }

View File

@ -64,11 +64,7 @@ public:
QColorTransform{other}.swap(*this); QColorTransform{other}.swap(*this);
return *this; return *this;
} }
QColorTransform &operator=(QColorTransform &&other) noexcept QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QColorTransform)
{
QColorTransform{std::move(other)}.swap(*this);
return *this;
}
void swap(QColorTransform &other) noexcept { qSwap(d, other.d); } void swap(QColorTransform &other) noexcept { qSwap(d, other.d); }

View File

@ -81,7 +81,7 @@ public:
const QMarginsF &margins, Unit units = Point, const QMarginsF &margins, Unit units = Point,
const QMarginsF &minMargins = QMarginsF(0, 0, 0, 0)); const QMarginsF &minMargins = QMarginsF(0, 0, 0, 0));
QPageLayout(const QPageLayout &other); QPageLayout(const QPageLayout &other);
QPageLayout &operator=(QPageLayout &&other) noexcept { swap(other); return *this; } QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QPageLayout)
QPageLayout &operator=(const QPageLayout &other); QPageLayout &operator=(const QPageLayout &other);
~QPageLayout(); ~QPageLayout();

View File

@ -232,7 +232,7 @@ public:
const QString &name = QString(), const QString &name = QString(),
SizeMatchPolicy matchPolicy = FuzzyMatch); SizeMatchPolicy matchPolicy = FuzzyMatch);
QPageSize(const QPageSize &other); QPageSize(const QPageSize &other);
QPageSize &operator=(QPageSize &&other) noexcept { swap(other); return *this; } QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QPageSize)
QPageSize &operator=(const QPageSize &other); QPageSize &operator=(const QPageSize &other);
~QPageSize(); ~QPageSize();

View File

@ -92,8 +92,7 @@ public:
explicit QPainterPath(const QPointF &startPoint); explicit QPainterPath(const QPointF &startPoint);
QPainterPath(const QPainterPath &other); QPainterPath(const QPainterPath &other);
QPainterPath &operator=(const QPainterPath &other); QPainterPath &operator=(const QPainterPath &other);
inline QPainterPath &operator=(QPainterPath &&other) noexcept QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QPainterPath)
{ qSwap(d_ptr, other.d_ptr); return *this; }
~QPainterPath(); ~QPainterPath();
inline void swap(QPainterPath &other) noexcept { d_ptr.swap(other.d_ptr); } inline void swap(QPainterPath &other) noexcept { d_ptr.swap(other.d_ptr); }

View File

@ -71,9 +71,8 @@ public:
QPen &operator=(const QPen &pen) noexcept; QPen &operator=(const QPen &pen) noexcept;
QPen(QPen &&other) noexcept QPen(QPen &&other) noexcept
: d(other.d) { other.d = nullptr; } : d(qExchange(other.d, nullptr)) {}
QPen &operator=(QPen &&other) noexcept QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QPen)
{ qSwap(d, other.d); return *this; }
void swap(QPen &other) noexcept { qSwap(d, other.d); } void swap(QPen &other) noexcept { qSwap(d, other.d); }
Qt::PenStyle style() const; Qt::PenStyle style() const;

View File

@ -70,12 +70,11 @@ public:
QRegion(const QPolygon &pa, Qt::FillRule fillRule = Qt::OddEvenFill); QRegion(const QPolygon &pa, Qt::FillRule fillRule = Qt::OddEvenFill);
QRegion(const QRegion &region); QRegion(const QRegion &region);
QRegion(QRegion &&other) noexcept QRegion(QRegion &&other) noexcept
: d(other.d) { other.d = const_cast<QRegionData*>(&shared_empty); } : d(qExchange(other.d, const_cast<QRegionData*>(&shared_empty))) {}
QRegion(const QBitmap &bitmap); QRegion(const QBitmap &bitmap);
~QRegion(); ~QRegion();
QRegion &operator=(const QRegion &); QRegion &operator=(const QRegion &);
inline QRegion &operator=(QRegion &&other) noexcept QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QRegion);
{ qSwap(d, other.d); return *this; }
inline void swap(QRegion &other) noexcept { qSwap(d, other.d); } inline void swap(QRegion &other) noexcept { qSwap(d, other.d); }
bool isEmpty() const; bool isEmpty() const;
bool isNull() const; bool isNull() const;

View File

@ -252,8 +252,7 @@ public:
bool operator<(const QFont &) const; bool operator<(const QFont &) const;
operator QVariant() const; operator QVariant() const;
bool isCopyOf(const QFont &) const; bool isCopyOf(const QFont &) const;
inline QFont &operator=(QFont &&other) noexcept QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QFont)
{ qSwap(d, other.d); qSwap(resolve_mask, other.resolve_mask); return *this; }
QString key() const; QString key() const;

View File

@ -304,14 +304,11 @@ public:
explicit Holder(void *p, qt_destroy_func_t d) : ptr(p), destroy_func(d) {} explicit Holder(void *p, qt_destroy_func_t d) : ptr(p), destroy_func(d) {}
~Holder() { if (ptr && destroy_func) destroy_func(ptr); } ~Holder() { if (ptr && destroy_func) destroy_func(ptr); }
Holder(Holder &&other) noexcept Holder(Holder &&other) noexcept
: ptr(other.ptr), : ptr(qExchange(other.ptr, nullptr)),
destroy_func(other.destroy_func) destroy_func(qExchange(other.destroy_func, nullptr))
{ {
other.ptr = nullptr;
other.destroy_func = nullptr;
} }
Holder &operator=(Holder &&other) noexcept QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(Holder)
{ swap(other); return *this; }
void swap(Holder &other) noexcept void swap(Holder &other) noexcept
{ {

View File

@ -60,8 +60,7 @@ public:
~QFontMetrics(); ~QFontMetrics();
QFontMetrics &operator=(const QFontMetrics &); QFontMetrics &operator=(const QFontMetrics &);
inline QFontMetrics &operator=(QFontMetrics &&other) noexcept QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QFontMetrics)
{ qSwap(d, other.d); return *this; }
void swap(QFontMetrics &other) noexcept void swap(QFontMetrics &other) noexcept
{ qSwap(d, other.d); } { qSwap(d, other.d); }
@ -131,8 +130,7 @@ public:
QFontMetricsF &operator=(const QFontMetricsF &); QFontMetricsF &operator=(const QFontMetricsF &);
QFontMetricsF &operator=(const QFontMetrics &); QFontMetricsF &operator=(const QFontMetrics &);
inline QFontMetricsF &operator=(QFontMetricsF &&other) noexcept QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QFontMetricsF)
{ qSwap(d, other.d); return *this; }
void swap(QFontMetricsF &other) noexcept { qSwap(d, other.d); } void swap(QFontMetricsF &other) noexcept { qSwap(d, other.d); }

View File

@ -66,7 +66,7 @@ public:
QGlyphRun(); QGlyphRun();
QGlyphRun(const QGlyphRun &other); QGlyphRun(const QGlyphRun &other);
QGlyphRun &operator=(QGlyphRun &&other) noexcept { swap(other); return *this; } QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QGlyphRun)
QGlyphRun &operator=(const QGlyphRun &other); QGlyphRun &operator=(const QGlyphRun &other);
~QGlyphRun(); ~QGlyphRun();

View File

@ -79,7 +79,7 @@ public:
qreal pixelSize, qreal pixelSize,
QFont::HintingPreference hintingPreference = QFont::PreferDefaultHinting); QFont::HintingPreference hintingPreference = QFont::PreferDefaultHinting);
QRawFont(const QRawFont &other); QRawFont(const QRawFont &other);
QRawFont &operator=(QRawFont &&other) noexcept { swap(other); return *this; } QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QRawFont)
QRawFont &operator=(const QRawFont &other); QRawFont &operator=(const QRawFont &other);
~QRawFont(); ~QRawFont();

View File

@ -64,7 +64,7 @@ public:
QStaticText(); QStaticText();
explicit QStaticText(const QString &text); explicit QStaticText(const QString &text);
QStaticText(const QStaticText &other); QStaticText(const QStaticText &other);
QStaticText &operator=(QStaticText &&other) noexcept { swap(other); return *this; } QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QStaticText)
QStaticText &operator=(const QStaticText &); QStaticText &operator=(const QStaticText &);
~QStaticText(); ~QStaticText();

View File

@ -73,7 +73,7 @@ public:
explicit QTextCursor(QTextFrame *frame); explicit QTextCursor(QTextFrame *frame);
explicit QTextCursor(const QTextBlock &block); explicit QTextCursor(const QTextBlock &block);
QTextCursor(const QTextCursor &cursor); QTextCursor(const QTextCursor &cursor);
QTextCursor &operator=(QTextCursor &&other) noexcept { swap(other); return *this; } QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QTextCursor)
QTextCursor &operator=(const QTextCursor &other); QTextCursor &operator=(const QTextCursor &other);
~QTextCursor(); ~QTextCursor();

View File

@ -109,7 +109,7 @@ public:
QOpenGLDebugMessage(const QOpenGLDebugMessage &debugMessage); QOpenGLDebugMessage(const QOpenGLDebugMessage &debugMessage);
QOpenGLDebugMessage &operator=(const QOpenGLDebugMessage &debugMessage); QOpenGLDebugMessage &operator=(const QOpenGLDebugMessage &debugMessage);
QOpenGLDebugMessage &operator=(QOpenGLDebugMessage &&other) noexcept { swap(other); return *this; } QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QOpenGLDebugMessage)
~QOpenGLDebugMessage(); ~QOpenGLDebugMessage();
void swap(QOpenGLDebugMessage &other) noexcept { qSwap(d, other.d); } void swap(QOpenGLDebugMessage &other) noexcept { qSwap(d, other.d); }

View File

@ -55,8 +55,7 @@ class Q_OPENGL_EXPORT QOpenGLPixelTransferOptions
public: public:
QOpenGLPixelTransferOptions(); QOpenGLPixelTransferOptions();
QOpenGLPixelTransferOptions(const QOpenGLPixelTransferOptions &); QOpenGLPixelTransferOptions(const QOpenGLPixelTransferOptions &);
QOpenGLPixelTransferOptions &operator=(QOpenGLPixelTransferOptions &&other) noexcept QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QOpenGLPixelTransferOptions)
{ swap(other); return *this; }
QOpenGLPixelTransferOptions &operator=(const QOpenGLPixelTransferOptions &); QOpenGLPixelTransferOptions &operator=(const QOpenGLPixelTransferOptions &);
~QOpenGLPixelTransferOptions(); ~QOpenGLPixelTransferOptions();