diff options
author | Marc Mutz <marc.mutz@qt.io> | 2022-01-19 08:40:34 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2022-01-21 13:10:19 +0100 |
commit | e6d4967f0bf150d746aceca3d9b209bde9728e8a (patch) | |
tree | aedda0db76f8c0d12c5447f15969fc4a1988e299 /src | |
parent | b9055da1738bc59cba7692ae34910c90e0859f67 (diff) |
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>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/tools/qarraydatapointer.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/tools/qarraydatapointer.h b/src/corelib/tools/qarraydatapointer.h index 2759810919..f7280b847f 100644 --- a/src/corelib/tools/qarraydatapointer.h +++ b/src/corelib/tools/qarraydatapointer.h @@ -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); } |