From 8662427d4877bea204a92fb342bdac91586b2b09 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 19 Sep 2017 18:41:32 +0200 Subject: [PATCH] util/HugeAllocator: use std::exchange() --- src/util/HugeAllocator.hxx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/util/HugeAllocator.hxx b/src/util/HugeAllocator.hxx index 75f75761e..7f75a7ce1 100644 --- a/src/util/HugeAllocator.hxx +++ b/src/util/HugeAllocator.hxx @@ -125,9 +125,7 @@ public: :data(HugeAllocate(_size)), size(_size) {} HugeAllocation(HugeAllocation &&src) noexcept - :data(src.data), size(src.size) { - src.data = nullptr; - } + :data(std::exchange(src.data, nullptr)), size(src.size) {} ~HugeAllocation() { if (data != nullptr)