From f8d7bc1c3481feefde02ba234fff723eb0bb8c93 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 9 Dec 2019 09:35:50 +0100 Subject: [PATCH] util/AllocatedArray: use std::exchange() --- src/util/AllocatedArray.hxx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/util/AllocatedArray.hxx b/src/util/AllocatedArray.hxx index cc79cb219..86ac833ff 100644 --- a/src/util/AllocatedArray.hxx +++ b/src/util/AllocatedArray.hxx @@ -1,5 +1,5 @@ /* - * Copyright 2010-2018 Max Kellermann + * Copyright 2010-2019 Max Kellermann * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -71,9 +71,7 @@ public: } AllocatedArray(AllocatedArray &&other) noexcept - :buffer(other.buffer) { - other.buffer = nullptr; - } + :buffer(std::exchange(other.buffer, nullptr)) {} ~AllocatedArray() noexcept { delete[] buffer.data;