fix erase_if method

This commit is contained in:
digant73 2025-04-26 15:32:49 +02:00
parent 89dea9bd92
commit 63a499c76b

View file

@ -390,7 +390,7 @@ namespace rsx
} }
bool ret = false; bool ret = false;
for (auto ptr = _data, last = _data + _size - 1; ptr <= last; ptr++) for (auto ptr = _data, last = _data + (_size - 1); ptr <= last; ptr++)
{ {
if (predicate(*ptr)) if (predicate(*ptr))
{ {
@ -405,7 +405,7 @@ namespace rsx
// Move item to the end of the list and shrink by 1 // Move item to the end of the list and shrink by 1
std::memcpy(ptr, last, sizeof(Ty)); std::memcpy(ptr, last, sizeof(Ty));
last = _data + (--_size); last = _data + (--_size - 1); // set new last
} }
} }