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`.
This commit is contained in:
mitaclaw 2024-08-22 18:17:26 -07:00
parent 21f4319302
commit 0352f24a8e
1 changed files with 3 additions and 3 deletions

View File

@ -1081,11 +1081,11 @@ void MovieManager::LoadInput(const std::string& movie_path)
std::vector<u8> 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