Use sead::OffsetList::robustRange() when possible to simplify iteration

This commit is contained in:
Léo Lam
2022-03-05 19:09:32 +01:00
parent d839816081
commit 88a0a9eb69
4 changed files with 12 additions and 13 deletions
@@ -31,9 +31,9 @@ void TaskQueueBase::clear() {
lock();
// Clear all tasks.
for (auto it = mActiveTasks.robustBegin(), end = mActiveTasks.robustEnd(); it != end; ++it) {
mActiveTasks.erase(std::addressof(*it));
it->onRemove();
for (auto& task : mActiveTasks.robustRange()) {
mActiveTasks.erase(&task);
task.onRemove();
}
mActiveTasks.clear();