From 165cf169e6dba9d8850d50237485ddfc0569e277 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Wed, 25 Oct 2023 15:36:28 -0400 Subject: [PATCH] refactor: extract the lambda method in tr_variant::Map::find() (#6161) experimental change for msvc 19.37 ftbfs --- libtransmission/variant.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/libtransmission/variant.h b/libtransmission/variant.h index 9fbe979a3..f2be8591a 100644 --- a/libtransmission/variant.h +++ b/libtransmission/variant.h @@ -85,12 +85,20 @@ public: [[nodiscard]] TR_CONSTEXPR20 auto find(tr_quark const key) noexcept { - return std::find_if(begin(), end(), [key](auto const& item) { return item.first == key; }); + auto const predicate = [key](auto const& item) + { + return item.first == key; + }; + return std::find_if(begin(), end(), predicate); } [[nodiscard]] TR_CONSTEXPR20 auto find(tr_quark const key) const noexcept { - return std::find_if(begin(), end(), [key](auto const& item) { return item.first == key; }); + auto const predicate = [key](auto const& item) + { + return item.first == key; + }; + return std::find_if(cbegin(), cend(), predicate); } [[nodiscard]] TR_CONSTEXPR20 auto size() const noexcept