From 59811ec78090da05f3a67318d942991688088201 Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Tue, 9 May 2023 21:51:46 +0100 Subject: [PATCH] Codechange: Use find_if when finding things. --- src/core/smallmap_type.hpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/core/smallmap_type.hpp b/src/core/smallmap_type.hpp index 744f9fd265..de3a72be70 100644 --- a/src/core/smallmap_type.hpp +++ b/src/core/smallmap_type.hpp @@ -40,11 +40,7 @@ struct SmallMap : std::vector > { */ inline typename std::vector::const_iterator Find(const T &key) const { - typename std::vector::const_iterator it; - for (it = std::vector::begin(); it != std::vector::end(); it++) { - if (key == it->first) return it; - } - return it; + return std::find_if(std::vector::begin(), std::vector::end(), [&key](const Pair &pair) { return key == pair.first; }); } /**