Properly delete element from unordered_map
This commit is contained in:
parent
97b16c6a5f
commit
86a36ceeef
@ -70,13 +70,15 @@ void IdStringList::updateElements(Context *ctx, std::vector<IdString> elements)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// For any elements that are in managed_ but not in new, delete them.
|
// For any elements that are in managed_ but not in new, delete them.
|
||||||
for (auto &pair : managed_) {
|
auto it = managed_.begin();
|
||||||
if (element_set.count(pair.first) != 0) {
|
while (it != managed_.end()) {
|
||||||
continue;
|
if (element_set.count(it->first) != 0) {
|
||||||
}
|
++it;
|
||||||
managed_.erase(pair.first);
|
} else {
|
||||||
|
it = managed_.erase(it);
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Return early if there are no changes.
|
// Return early if there are no changes.
|
||||||
if (!changed)
|
if (!changed)
|
||||||
|
Loading…
Reference in New Issue
Block a user