diff options
author | Marc Mutz <marc.mutz@qt.io> | 2022-03-15 21:20:46 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-10-11 10:56:15 +0000 |
commit | 935edbb598363e4a73477ce8479b66e99a6cfd5a (patch) | |
tree | 4ec6290013b45f7b455eafe182a52e4a66d5722f | |
parent | 158eb90211c15358c054fe422a1a283163baaef2 (diff) |
qcore_mac_p.h: compile-optimize inline swap functions
Instead of using the overly-generic qSwap() monster, use
- qt_ptr_swap() for swapping raw pointers
- member-swap for swapping smart pointers
- std::swap() for swapping scalars
In QtCore, this has proven to give a nice reduction in compile time
for Qt users, cf. b1b0c2970e480ef460a61f37fa430dc443390358.
Task-number: QTBUG-97601
Change-Id: Iad8e6c11ebcc3ff822479c36f5faff88992b1165
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit e08fa9cc01f11ce61258e0d9a138118bff3453c8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/corelib/kernel/qcore_mac_p.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/corelib/kernel/qcore_mac_p.h b/src/corelib/kernel/qcore_mac_p.h index 7633b7420c..395b426cf4 100644 --- a/src/corelib/kernel/qcore_mac_p.h +++ b/src/corelib/kernel/qcore_mac_p.h @@ -310,8 +310,8 @@ public: void swap(QAppleLogActivity &other) { - qSwap(activity, other.activity); - qSwap(state, other.state); + activity.swap(other.activity); + std::swap(state, other.state); } private: @@ -368,7 +368,7 @@ public: void swap(QMacNotificationObserver &other) noexcept { - qSwap(observer, other.observer); + qt_ptr_swap(observer, other.observer); } void remove(); @@ -418,9 +418,9 @@ public: void swap(QMacKeyValueObserver &other) noexcept { - qSwap(object, other.object); - qSwap(keyPath, other.keyPath); - qSwap(callback, other.callback); + qt_ptr_swap(object, other.object); + qt_ptr_swap(keyPath, other.keyPath); + callback.swap(other.callback); } private: |