Invalidating Iterators for Fun and Profit
The following code throws a Read Access Violation exception:
std::vector<int> v{ 1, 2, 3, 4, 5 };
std::vector<int>::iterator it = v.begin();
std::cout << "Iterator value: " << *it << "\n";
v.push_back(6);
std::cout << "Iterator value: " << *it << "\...
chrisspicer.hashnode.dev2 min read