diff --git a/defensive-coding/en-US/CXX-Std.xml b/defensive-coding/en-US/CXX-Std.xml index 181ad48..88fa803 100644 --- a/defensive-coding/en-US/CXX-Std.xml +++ b/defensive-coding/en-US/CXX-Std.xml @@ -87,7 +87,7 @@
Containers and <literal>operator[]</literal> - Many containers similar to std::vector + Many sequence containers similar to std::vector provide both operator[](size_type) and a member function at(size_type). This applies to std::vector itself, @@ -105,5 +105,25 @@ slightly more verbose.
+
+ Iterators + + Iterators do not perform any bounds checking. Therefore, all + functions that work on iterators should accept them in pairs, + denoting a range, and make sure that iterators are not moved + outside that range. For forward iterators and bidirectional + iterators, you need to check for equality before moving the + first or last iterator in the range. For random-access + iterators, you need to compute the difference before adding or + subtracting an offset. It is not possible to perform the + operation and check for an invalid operator afterwards. + + + Output iterators cannot be compared for equality. Therefore, it + is impossible to write code that detects that it has been + supplied an output area that is too small, and their use should + be avoided. + +