From d5889bff8b3d7ca0cf516f8a5a5e9a6698849bb3 Mon Sep 17 00:00:00 2001 From: Felix Heitmann Date: Fri, 5 Jul 2024 14:56:11 +0200 Subject: [PATCH] Attributes: invert attr search logic --- include/spdlog/attributes.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/spdlog/attributes.h b/include/spdlog/attributes.h index f3ce23a8..5b7fb141 100644 --- a/include/spdlog/attributes.h +++ b/include/spdlog/attributes.h @@ -52,11 +52,12 @@ public: return attrs.empty(); } + // return {true, iter} if found, {false, end} otherwise std::pair const get(key_t const& key) const { auto lck = lock(); auto value_it = attrs.find(key); - return std::make_pair(value_it == attrs.end(), value_it); + return std::make_pair(value_it != attrs.end(), value_it); } // provide a local copy of the attributes to be free of race issues