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:
parent
21f4319302
commit
0352f24a8e
|
@ -1081,11 +1081,11 @@ void MovieManager::LoadInput(const std::string& movie_path)
|
||||||
std::vector<u8> movInput(m_current_byte);
|
std::vector<u8> movInput(m_current_byte);
|
||||||
t_record.ReadArray(movInput.data(), movInput.size());
|
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.
|
// 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
|
// we'll try to say what's going on in excruciating detail, otherwise the user might not
|
||||||
|
|
Loading…
Reference in New Issue