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. Pick-to: 6.4 6.3 6.2 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>
This commit is contained in:
parent
d4e62a9768
commit
e08fa9cc01
@ -284,8 +284,8 @@ public:
|
|||||||
|
|
||||||
void swap(QAppleLogActivity &other)
|
void swap(QAppleLogActivity &other)
|
||||||
{
|
{
|
||||||
qSwap(activity, other.activity);
|
activity.swap(other.activity);
|
||||||
qSwap(state, other.state);
|
std::swap(state, other.state);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -342,7 +342,7 @@ public:
|
|||||||
|
|
||||||
void swap(QMacNotificationObserver &other) noexcept
|
void swap(QMacNotificationObserver &other) noexcept
|
||||||
{
|
{
|
||||||
qSwap(observer, other.observer);
|
qt_ptr_swap(observer, other.observer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void remove();
|
void remove();
|
||||||
@ -392,9 +392,9 @@ public:
|
|||||||
|
|
||||||
void swap(QMacKeyValueObserver &other) noexcept
|
void swap(QMacKeyValueObserver &other) noexcept
|
||||||
{
|
{
|
||||||
qSwap(object, other.object);
|
qt_ptr_swap(object, other.object);
|
||||||
qSwap(keyPath, other.keyPath);
|
qt_ptr_swap(keyPath, other.keyPath);
|
||||||
qSwap(callback, other.callback);
|
callback.swap(other.callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user