vector::erase invalidates any iterators at/after the erase position

This commit is contained in:
Nathan Burles 2016-07-18 13:52:45 +01:00
parent 6de938dbf7
commit ba5cf0060c
1 changed files with 1 additions and 1 deletions

View File

@ -128,7 +128,7 @@ void IntervalSet::add(const Interval &addition) {
}
// if we bump up against or overlap next, merge
_intervals.erase(iterator);// remove this one
iterator = _intervals.erase(iterator);// remove this one
--iterator; // move backwards to what we just set
*iterator = bigger.Union(next); // set to 3 merged ones
// ml: no need to advance iterator, we do that in the next round anyway. ++iterator; // first call to next after previous duplicates the result