Since I know an iterator in the program could be invalidated by some previous operation, I want to invalidate it explicitly. Such as assign NULL to a pointer to invalidate i
could be invalidated by some previous operation, I want to invalidate it explicitly
... If you know it may not be valid, then all you have to do it stop using it. Invalidating the iterator explicitly accomplishes nothing, because using it is a programming error either way.