Skip to content

Commit

Permalink
#410: util: use tmp var so erase does not follow modify
Browse files Browse the repository at this point in the history
  • Loading branch information
lifflander committed Jun 25, 2019
1 parent aeed355 commit 0945348
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/vt/termination/interval/discrete_interval.h
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,9 @@ struct IntervalSetBase {
if (it not_eq set_.begin()) {
auto prev = std::prev(it);
if (it->tangent(*prev) == PositionType::TangentLeft) {
it->join(*prev, PositionType::TangentLeft);
auto tmp = *prev;
set_.erase(prev);
it->join(tmp, PositionType::TangentLeft);
}
}
return it;
Expand All @@ -358,8 +359,9 @@ struct IntervalSetBase {
auto next = std::next(it);
if (it not_eq set_.end()) {
if (it->tangent(*next) == PositionType::TangentRight) {
it->join(*next, PositionType::TangentRight);
auto tmp = *next;
set_.erase(next);
it->join(tmp, PositionType::TangentRight);
}
}
return it;
Expand Down

0 comments on commit 0945348

Please sign in to comment.