Iterator ranges must be valid ranges. Passing two iterators where the first doesn't precede the second or that don't both refer into the same container can result in undefined behavior equivalent to a buffer overflow.
...
Wiki Markup |
---|
\[[Sutter 05|AA. C++ References#Sutter 05]\] Item 83: Use a checked STL implementation.
\[[Meyers 01|AA. C++ References#Meyers 01]\] Item 21: Always have comparison functions return false for equal values.
\[[ISO/IEC 14882-2003|AA. C++ References#ISO/IEC 14882-2003]\] Section 24: Iterators Library. |
...
STL30-C. Use Valid Iterators 14. Templates and the STL (TPL) STL32-C. Use a Valid Ordering Rule