Say I have a simple program as so:
int main(void) {
std::list<int> l;
auto it = l.begin();
auto it2 = l.insert(l.begin(), 5);
std::cout << (it == it2) << std::endl;
}
Doesn't this show that the iterator it
has been invalidated by inserting into the list. Yet the C++ standard says that insertion into a list does not invalidate iterators.
Originally it
would probably hold a nullptr since the list was empty. Now it
no longer points to any iterator part of the list. So is it
not invalidated?