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. Pick-to: 6.5 Change-Id: I18976cffe30eb4e37aa6d471cc6e75015e9b1ee7 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
This commit is contained in:
parent
5ba2590388
commit
c2cdd7c371
@ -92,7 +92,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