...
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 CTR32-CPP. Do not use iterators invalidated by container modificationUse valid references, pointers, and iterators to reference elements of a container.
Noncompliant Code Example
...
Search for vulnerabilities resulting from the violation of this rule on the CERT website.
Related Guidelines
CERT C++ Coding Standard | CTR32-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 |
07007. Characters and Strings (STR) STR39-CPP. Range check element access