diff options
| author | Léo Lam <leo@leolam.fr> | 2022-03-05 19:09:32 +0100 |
|---|---|---|
| committer | Léo Lam <leo@leolam.fr> | 2022-03-05 19:13:06 +0100 |
| commit | 88a0a9eb691a3c1925e9b5d185fb12550618e5f8 (patch) | |
| tree | ec055bc9747a1c01d45231eadc204858af39422f /src/KingSystem/Utils/Thread/TaskQueueBase.cpp | |
| parent | d839816081398859f95668e2c5aad872d24919f0 (diff) | |
Use sead::OffsetList::robustRange() when possible to simplify iteration
Diffstat (limited to 'src/KingSystem/Utils/Thread/TaskQueueBase.cpp')
| -rw-r--r-- | src/KingSystem/Utils/Thread/TaskQueueBase.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/KingSystem/Utils/Thread/TaskQueueBase.cpp b/src/KingSystem/Utils/Thread/TaskQueueBase.cpp index 0e8853c8..5310726c 100644 --- a/src/KingSystem/Utils/Thread/TaskQueueBase.cpp +++ b/src/KingSystem/Utils/Thread/TaskQueueBase.cpp @@ -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(); |
