
On Fri, Sep 30, 2011 at 12:31 PM, Andrew Sutton
Why not? Isn't an object equal to itself?
Because a singular iterator can be a uninitialized variable and you can't equally-compare a uninitialized variable, nor copy it. All you can do is assign and destroy it.
I know what the standard says, but shouldn't this always return true?
It should what the standard says. If it says anything can happen, then anything can happen. Including crashing. It is perfectly possible for a CPU to trap on uninitialized variables for example.
int* i; assert(i == i);
Regardless of the actual value? It seems to me that this is a pretty fundamental property: an object is always equal to itself*. If you believe it, then you're allowed to construct empty bounded ranges of singular values [i, i).
* Excluding volatile objects.
Regards, -- Felipe Magno de Almeida