
AMDG On 12/06/2012 12:10 AM, "Claas H. Köhler" wrote:
Hi John. You are correct. The following code returns false/0 (with gcc-4.7):
typedef std::array<double, 10>::iterator T; T ita1, ita2;
std::cout << (ita1 == ita2) <<std::endl;
However, you can tweak it like this:
typedef std::array<double, 10>::iterator T; T ita1=T(), ita2=T();
std::cout << (ita1 == ita2) <<std::endl;
and it returns true /1. It is mainly the lack of this functionality which is on my wish-list for the counting_iterator.
This is still undefined behavior. "Iterators can also have singular values that are not associated with any sequence. ... 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 hold 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." (C++11 24.2.1) In Christ, Steven Watanabe