Consider standard algorithms like, say, std::for_each.
template
Function for_each(InputIterator first
The standard explicitly requires the last iterator to be reachable from the first iterator. That means that by incrementing first one should be able to eventually hit last.
24.1 Iterator requirements
...
6 An iterator
jis called reachable from an iteratoriif and only if there is a finite sequence of applications of the expression++ithat makesi == j. Ifjis reachable fromi, they refer to the same container.7 Most of the library’s algorithmic templates that operate on data structures have interfaces that use ranges. A range is a pair of iterators that designate the beginning and end of the computation. A range
[i, i)is an empty range; in general, a range[i, j)refers to the elements in the data structure starting with the one pointed to byiand up to but not including the one pointed to byj. Range[i, j)is valid if and only ifjis reachable fromi. The result of the application of functions in the library to invalid ranges is undefined.