From 16195ec34ade9ab2f138a5b93f789c5e540eb88b Mon Sep 17 00:00:00 2001 From: Fei Chong Date: Mon, 30 Nov 2020 18:19:14 +0800 Subject: [PATCH] Update null_mutex.h Using std::exchange for null_atomic_int::exchange --- include/spdlog/details/null_mutex.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/spdlog/details/null_mutex.h b/include/spdlog/details/null_mutex.h index 83533d4f..912c6438 100644 --- a/include/spdlog/details/null_mutex.h +++ b/include/spdlog/details/null_mutex.h @@ -40,8 +40,7 @@ struct null_atomic_int int exchange(int new_value, std::memory_order = std::memory_order_relaxed) { - std::swap(new_value, value); - return new_value; // return value before the call + return std::exchange(new_value, value); } };