Merge pull request #12 from YosysHQ/fix-updateelements
Properly delete element from unordered_map
This commit is contained in:
commit
62e61c44e8
@ -70,12 +70,14 @@ 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;
|
||||||
|
} else {
|
||||||
|
it = managed_.erase(it);
|
||||||
|
changed = true;
|
||||||
}
|
}
|
||||||
managed_.erase(pair.first);
|
|
||||||
changed = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return early if there are no changes.
|
// Return early if there are no changes.
|
||||||
|
Loading…
Reference in New Issue
Block a user