I’m implementing my own std::map, using a basic binary search tree.
The erase method is supposed to
invalidate the iterators referring to element removed and preserve the
validity of all other iterators
Yet here is what the BST “classic” delete algorithm is doing:
If node to be deleted A has two children, “replace” A by its in-order successor / predecessor B and the delete B.
In the end, iterators to B are invalidated.
So validity of “other” iterator is not preserved.
Is the algorithm I’ve found not suitable ?