Q<Typed>Permission: use move-and-swap, not pure-swap, for move-assignment
While PURE_SWAP is the correct one today, this is inline code, so when we activate the d-pointer, we may have fields that hold non-memory resources, but it would be too late change existing binary users to MOVE_AND_SWAP, so do it already now. Change-Id: I18976cffe30eb4e37aa6d471cc6e75015e9b1ee7 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> (cherry picked from commit c2cdd7c371d7b9405728c1a30046ab3f257ee235) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
88f28bbbc3
commit
9656e4fda6
@ -89,7 +89,7 @@ public: \
|
||||
: u{other.u} { other.u.d = nullptr; } \
|
||||
Q_CORE_EXPORT ~ClassName(); \
|
||||
Q_CORE_EXPORT ClassName &operator=(const ClassName &other) noexcept; \
|
||||
QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(ClassName) \
|
||||
QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(ClassName) \
|
||||
void swap(ClassName &other) noexcept { std::swap(u, other.u); } \
|
||||
private: \
|
||||
/*end*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user