From 0352f24a8ee0b8c079df065b5155ea576727db3d Mon Sep 17 00:00:00 2001 From: mitaclaw <140017135+mitaclaw@users.noreply.github.com> Date: Thu, 22 Aug 2024 18:17:26 -0700 Subject: [PATCH] Modernize `std::mismatch` with ranges The new return value is `std::ranges::mismatch_result`, an alias for the pair-like type `std::ranges::in_in_result`. --- Source/Core/Core/Movie.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/Core/Core/Movie.cpp b/Source/Core/Core/Movie.cpp index 89e6d45d31..19841d8cfc 100644 --- a/Source/Core/Core/Movie.cpp +++ b/Source/Core/Core/Movie.cpp @@ -1081,11 +1081,11 @@ void MovieManager::LoadInput(const std::string& movie_path) std::vector movInput(m_current_byte); t_record.ReadArray(movInput.data(), movInput.size()); - const auto result = std::mismatch(movInput.begin(), movInput.end(), m_temp_input.begin()); + const auto mismatch_result = std::ranges::mismatch(movInput, m_temp_input); - if (result.first != movInput.end()) + if (mismatch_result.in1 != movInput.end()) { - const ptrdiff_t mismatch_index = std::distance(movInput.begin(), result.first); + const ptrdiff_t mismatch_index = std::distance(movInput.begin(), mismatch_result.in1); // this is a "you did something wrong" alert for the user's benefit. // we'll try to say what's going on in excruciating detail, otherwise the user might not