diff options
author | Anton Kudryavtsev <anton.kudryavtsev@vk.team> | 2023-10-30 14:55:25 +0300 |
---|---|---|
committer | Anton Kudryavtsev <anton.kudryavtsev@vk.team> | 2023-11-01 23:05:39 +0300 |
commit | d0b90663a4e82493cc08033a3b93ee708a486db6 (patch) | |
tree | 472893c752b5245d9761df138bd4b05743293a0e | |
parent | f331171dd734a565f649f6eade46fd71a38c92cf (diff) |
qarraydatapointer: use use std::exchange more
to simplify code
Change-Id: I7fc6dd92922eb30a16260544223c1dbfc3162188
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
-rw-r--r-- | src/corelib/tools/qarraydatapointer.h | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/corelib/tools/qarraydatapointer.h b/src/corelib/tools/qarraydatapointer.h index 2fbd6c7505..3969076e0c 100644 --- a/src/corelib/tools/qarraydatapointer.h +++ b/src/corelib/tools/qarraydatapointer.h @@ -75,11 +75,10 @@ public: Q_NODISCARD_CTOR QArrayDataPointer(QArrayDataPointer &&other) noexcept - : d(other.d), ptr(other.ptr), size(other.size) + : d(std::exchange(other.d, nullptr)), + ptr(std::exchange(other.ptr, nullptr)), + size(std::exchange(other.size, 0)) { - other.d = nullptr; - other.ptr = nullptr; - other.size = 0; } QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QArrayDataPointer) |