diff options
author | Marc Mutz <marc.mutz@qt.io> | 2022-05-06 19:07:42 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2022-05-07 23:19:15 +0200 |
commit | eff31bf486c2f6b9fcc43e526566cd381aad2d6f (patch) | |
tree | 718515f6b785be70afb9e9382859d38ee84f7cf5 /src/qml/qml/qqmlpropertycachecreator_p.h | |
parent | af50ec087e44a9102f4e66e7fed4385c108aced3 (diff) |
QtDeclarative: replace qSwap with std::swap/member-swap where possible
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 <marten.nordheim@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlpropertycachecreator_p.h')
-rw-r--r-- | src/qml/qml/qqmlpropertycachecreator_p.h | 2 |
1 files changed, 1 insertions, 1 deletions
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<ObjectContainer>::appendAliasPropertie } } - qSwap(objectsWithAliases, pendingObjects); + objectsWithAliases = std::move(pendingObjects); } while (!objectsWithAliases.isEmpty()); } |