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
You can't, in general. There are some iterators that cannot be invalidated at all. For instance, a random number generator can be modelled as an output iterator, with operator* returning the current number and operator++ generating a new one.