This is the mail archive of the
mailing list for the libstdc++ project.
Re: [PATCH] Fix PR libstdc++/19510: Uninitialized variable in some iterators
On Sat, Jan 22, 2005 at 07:16:28AM +0100, Gabriel Dos Reis wrote:
> From the perspective that iterators are "generalizations" of pointers,
> there is a missing value, the analogous of null pointer and its
> ability to serve as "sentinal" or special (not singular) value.
> If T is a pointer type, then T() is a null pointer and it can be used
> as a special value. That guarantee is missing for general iterators.
> I hope Sylvain would step in and explain the various occasions where
> that irregularity gets into the way.
As I recall, the notion of a null iterator was deliberately omitted
as tending to make both implementations and user code more complicated,
with no overarching benefit. Manifestly, we get along fine without.
However, I do seem to recall also that when the STL was proffered,
T() notation didn't work as it does now when T was a pointer.