Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2004-07-18 17:50:06

Stefan Slapeta <stefan_nospam__at_[hidden]> writes:

> Stefan Slapeta wrote:
> I think I just wrote down the logic reason for the bug:
>> I'm not sure if I understand correctly what you mean, but the
>> default constructed iterator is inteded to represent the
>> past-the-end value.
> When two iterators are compared, STLPort (in debug mode) checks if
> they have the same 'owner'. Of course, this owner can never be set for
> an iterator which behaves like above.

If STLPort is complaining about that, it's because what you're doing
is illegal. A default constructed standard container iterator is
"singular", and no operations on it (including comparison) are legal
other than assigning a non-singular iterator value into it. Although
a few specialized iterators in std:: work differently
(e.g. istream_iterator), in general you have to make the same
assumption for any other iterator.

> Any solution which doesn't break the syntax? I don't have any idea
> which could be implemented easily...

Post some more detail about what you mean by "the syntax" please.

Dave Abrahams
Boost Consulting

Boost list run by bdawes at, gregod at, cpdaniel at, john at