diff options
author | Marc Mutz <marc.mutz@qt.io> | 2022-05-11 17:27:16 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-05-17 13:44:58 +0000 |
commit | eebaf5c62da1ad3d0d7ca3143a898278e5c9de37 (patch) | |
tree | 7602e1803bee41e40567a9a3ee8579d0f117c92b /src/core | |
parent | 787b14eb95ace321ab3a199ab8fbdf546a72dbd1 (diff) |
QtWebEngine: replace qSwap with member-swap where possible
qSwap() is a monster that looks for ADL overloads of swap() and also
detects the noexcept of the wrapped swap() function, so it should only
be used when the argument type is unknown. In the vast majority of
cases, the type is known to be efficiently std::swap()able or to have
a member-swap. Call either of these.
As a drive-by, unify all member-swap()s to be noexcept.
Task-number: QTBUG-97601
Change-Id: I9184cab0ed74a1b32d62cf7c83dc1f1b7814c784
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 99b81083ccee7e1bd28749b1066599670713cefe)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/api/qwebenginehistory.h | 2 | ||||
-rw-r--r-- | src/core/api/qwebenginehttprequest.h | 2 | ||||
-rw-r--r-- | src/core/api/qwebenginescript.h | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/src/core/api/qwebenginehistory.h b/src/core/api/qwebenginehistory.h index 6afb8d8c1..2e5dfcd9a 100644 --- a/src/core/api/qwebenginehistory.h +++ b/src/core/api/qwebenginehistory.h @@ -74,7 +74,7 @@ public: bool isValid() const; - void swap(QWebEngineHistoryItem &other) Q_DECL_NOTHROW { qSwap(d, other.d); } + void swap(QWebEngineHistoryItem &other) noexcept { d.swap(other.d); } private: QWebEngineHistoryItem(QWebEngineHistoryItemPrivate *priv); diff --git a/src/core/api/qwebenginehttprequest.h b/src/core/api/qwebenginehttprequest.h index b302217f2..65b2e8f98 100644 --- a/src/core/api/qwebenginehttprequest.h +++ b/src/core/api/qwebenginehttprequest.h @@ -73,7 +73,7 @@ public: QWebEngineHttpRequest &operator=(const QWebEngineHttpRequest &other); static QWebEngineHttpRequest postRequest(const QUrl &url, const QMap<QString, QString> &postData); - void swap(QWebEngineHttpRequest &other) Q_DECL_NOTHROW { qSwap(d, other.d); } + void swap(QWebEngineHttpRequest &other) noexcept { d.swap(other.d); } bool operator==(const QWebEngineHttpRequest &other) const; inline bool operator!=(const QWebEngineHttpRequest &other) const { return !operator==(other); } diff --git a/src/core/api/qwebenginescript.h b/src/core/api/qwebenginescript.h index a9b1bb869..4d2ecd2e5 100644 --- a/src/core/api/qwebenginescript.h +++ b/src/core/api/qwebenginescript.h @@ -107,7 +107,7 @@ public: bool operator==(const QWebEngineScript &other) const; inline bool operator!=(const QWebEngineScript &other) const { return !operator==(other); } - void swap(QWebEngineScript &other) { qSwap(d, other.d); } + void swap(QWebEngineScript &other) noexcept { d.swap(other.d); } private: friend class QWebEngineScriptCollectionPrivate; |