From eff31bf486c2f6b9fcc43e526566cd381aad2d6f Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 6 May 2022 19:07:42 +0200 Subject: QtDeclarative: replace qSwap with std::swap/member-swap where possible MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. For the common case of pointer types, circumvent the expensive trait checks on std::swap() by using our hand-rolled qt_ptr_swap() template, the advantage being that it can be unconditionally noexcept, removing all type traits instantiations. In QQmlPropertyCacheAliasCreator, replace the qSwap() with std::move(). Task-number: QTBUG-97601 Pick-to: 6.3 6.2 5.15 Change-Id: I8b78a3ad287ce8565ca258ff38261e4d2cf0be63 Reviewed-by: MÃ¥rten Nordheim --- src/qml/qml/qqmlpropertycachecreator_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/qml/qml/qqmlpropertycachecreator_p.h') diff --git a/src/qml/qml/qqmlpropertycachecreator_p.h b/src/qml/qml/qqmlpropertycachecreator_p.h index 5aa1abcbe7..f683dc208c 100644 --- a/src/qml/qml/qqmlpropertycachecreator_p.h +++ b/src/qml/qml/qqmlpropertycachecreator_p.h @@ -871,7 +871,7 @@ inline void QQmlPropertyCacheAliasCreator::appendAliasPropertie } } - qSwap(objectsWithAliases, pendingObjects); + objectsWithAliases = std::move(pendingObjects); } while (!objectsWithAliases.isEmpty()); } -- cgit v1.2.3