Iterator invalidation rules for C++ containers

C++17 (All references are from the final working draft of CPP17 – n4659) Insertion Sequence Containers vector: The functions insert, emplace_back, emplace, push_back cause reallocation if the new size is greater than the old capacity. Reallocation invalidates all the references, pointers, and iterators referring to the elements in the sequence. If no reallocation happens, all … Read more

tech