Use C++20 erase_if() instead of erase(remove_if()) (NFC)

This commit is contained in:
Tillmann Karras committed 2024-07-21 16:36:06 +01:00
1 parent 1fcb2ee5c1
commit 982893b04c
4 files changed
+13 -22

No files matched your search

+3 -4
View File
@@ -282,13 +282,12 @@ void CoreTimingManager::ScheduleEvent(s64 cycles_into_future, EventType* event_t
void CoreTimingManager::RemoveEvent(EventType* event_type)
{
auto itr = std::remove_if(m_event_queue.begin(), m_event_queue.end(),
[&](const Event& e) { return e.type == event_type; });
const size_t erased =
std::erase_if(m_event_queue, [&](const Event& e) { return e.type == event_type; });
// Removing random items breaks the invariant so we have to re-establish it.
if (itr != m_event_queue.end())
if (erased != 0)
{
m_event_queue.erase(itr, m_event_queue.end());
std::make_heap(m_event_queue.begin(), m_event_queue.end(), std::greater<Event>());
}
}