Skip to content

Commit

Permalink
Fixed erase return iterator.
Browse files Browse the repository at this point in the history
  • Loading branch information
5cript committed Jul 31, 2024
1 parent 639401d commit dfda487
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions include/interval-tree/interval_tree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -885,14 +885,20 @@ namespace lib_interval_tree
if (!iter.node_)
throw std::out_of_range("cannot erase end iterator");

auto next = iter;
++next;
iterator next = iter;

node_type* y;
if (!iter.node_->left_ || !iter.node_->right_)
{
y = iter.node_;
++next;
}
else
{
y = successor(iter.node_);
next = iterator{y, this};
++next;
}

node_type* x;
if (y->left_)
Expand Down

0 comments on commit dfda487

Please sign in to comment.