...
Do not use a reference, pointer, or iterator that has been invalidated, as that results in undefined behavior. This rule is a specific instance of CTR32CTR51-CPP. Use valid references, pointers, and iterators to reference elements of a container.
Noncompliant Code Example
...
Related Guidelines
CERT C++ Coding Standard | CTR32CTR51-CPP. Use valid references, pointers, and iterators to reference elements of a container |
Bibliography
[ISO/IEC 14882-2014] | 21.4.1, " |
[Meyers 01] | Item 43: Prefer algorithm calls to hand-written loops |
...