QArrayDataPointer: don't overload qSwap(), provide ADL-swap()
qSwap() is our wrapper around using std::swap; swap(lhs, rhs); it needn't and shouldn't be overloaded. ADL swap() should be, though, so qSwap(), std::ranges::swap() and all the other adl_swap()s out there all find the optimized version. Qt 5.15 has it correct, Qt 6 wrong. Fix it. Can't pick to 6.2 because, while backwards-source-compatible, because the generic qSwap() template provides the name for both qualified and unqualified calls, it's not forwards-source-compatible: A new user of ADL swap // compile error w/o `using std::swap`, pessimization otherwise: swap(dp1, dp2); would break or performance-regress when going back to an older version. Pick-to: 6.3 Change-Id: I725949a4aa9ae438a182b4b7552ff2dced767e2f Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
parent
b9055da173
commit
e6d4967f0b
@ -415,7 +415,7 @@ public:
|
||||
};
|
||||
|
||||
template <class T>
|
||||
inline void qSwap(QArrayDataPointer<T> &p1, QArrayDataPointer<T> &p2) noexcept
|
||||
inline void swap(QArrayDataPointer<T> &p1, QArrayDataPointer<T> &p2) noexcept
|
||||
{
|
||||
p1.swap(p2);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user