Boost logo

Boost Users :

Subject: Re: [Boost-users] A forward iterator need not be default-constructible
From: Andrew Sutton (asutton.list_at_[hidden])
Date: 2011-09-30 11:31:13

>> 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?

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.

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at