I had a problem with iterators. What should I do if I have an iterator for the tree, and there is a need to implement the erase function in order to start deleting tree nodes от first до last ?
The problem is that I have in the iterator a pointer to a specific tree element, and the iterator functions are actively working with it.
But if you delete the node to which the iterator is pointing, the link is no longer active, the whole for goes to the tail, and the ++ increment operator cannot move to the next node.
Could you tell me how to solve this problem?
PS If necessary, attach examples of the iterator code and delete the tree element.