From d0b90663a4e82493cc08033a3b93ee708a486db6 Mon Sep 17 00:00:00 2001 From: Anton Kudryavtsev Date: Mon, 30 Oct 2023 14:55:25 +0300 Subject: [PATCH] qarraydatapointer: use use std::exchange more to simplify code Change-Id: I7fc6dd92922eb30a16260544223c1dbfc3162188 Reviewed-by: Thiago Macieira --- src/corelib/tools/qarraydatapointer.h | 7 +++---- 1 file 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)