Iterator rule in C++?
1 min readFeb 13, 2020
I am not sure whether the below is true. Should have a deep understanding of this.
“ One thing worth pointing attention to is C++ iterator validity after erase() operations. For data structures such as lists and set and unordered_sets, an iterator to any element besides the one that gets erased() remain valid. For other data structures such as vectors and deques, this is not the case. So be careful which data structure you use to implement this algorithm and be sure to read up on its iterator invalidation rules.”