From 140252ffc0ae71e8b5309bff7d6550189c602702 Mon Sep 17 00:00:00 2001 From: mitaclaw <140017135+mitaclaw@users.noreply.github.com> Date: Mon, 30 Sep 2024 17:26:50 -0700 Subject: Modernize `std::any_of` with ranges In WiimoteReal.cpp, JitRegCache.cpp, lambda predicates were replaced by pointers to member functions because ranges algorithms are able invoke those. In ConvertDialog.cpp, the `std::mem_fn` helper was removed because ranges algorithms are able to handle pointers to member functions as predicates. --- Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp') diff --git a/Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp b/Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp index fb9d43f22f..40ef725b66 100644 --- a/Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp +++ b/Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp @@ -137,8 +137,8 @@ BuildExpression(const std::vector void RemoveSpuriousTriggerCombinations( std::vector* detections) { - const auto is_spurious = [&](auto& detection) { - return std::any_of(detections->begin(), detections->end(), [&](auto& d) { + const auto is_spurious = [&](const auto& detection) { + return std::ranges::any_of(*detections, [&](const auto& d) { // This is a spurious digital detection if a "smooth" (analog) detection is temporally near. return &d != &detection && d.smoothness > 1 && d.smoothness > detection.smoothness && abs(d.press_time - detection.press_time) < SPURIOUS_TRIGGER_COMBO_THRESHOLD; -- cgit v1.2.3