
Just to clarify A singular iterator can be safely compared with other iterators. It can not be dereferenced or incremented. A default constructed boost::counting_iterator<unsigned> can not safely be compared. Can you cite a part of the standard which guarantees this? I only found 24.2.1, number 5 (in my
On 05/12/12 17:31, Peter Sommerlad wrote: preliminary version of the C++11 standard) <quote> Results of most expressions are undefined for singular values; the only exceptions are destroying an iterator that holds a singular value, the assignment of a non-singular value to an iterator that holds a singular value, and, for iterators that satisfy the DefaultConstructible requirements, using a value-initialized iterator as the source of a copy or move operation. [ Note: This guarantee is not offered for default initialization, although the distinction only matters for types with trivial default constructors such as pointers or aggregates holding pointers. — end note ] In these cases the singular value is overwritten the same way as any other value. Dereferenceable values are always non-singular. <\quote>
From which part do you conclude that comparisons are well-defined?