From: Stefan Slapeta (stefan_nospam__at_[hidden])
Date: 2004-07-19 04:50:57
Stefan Slapeta wrote:
> David Abrahams wrote:
>> 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.
Very strange: the behaviour that the default constructor equals the
past-the-end value is used for the example but it's not even documented
for the find iterator!
See the example: http://tinyurl.com/4vzlm
typedef find_iterator<string::iterator> string_find_iterator;
make_find_iterator(str1, first_finder("abc", is_iequal()));
See the find iterator documentation: http://tinyurl.com/53j5x
Construct null iterator. All null iterators are equal.
The example above implies that a find iterator which points to the last
element will become a 'null iterator' after incrementation. (However, I
didn't find this statement anywhere in the documentation)
Thus, fixing this bug would not only mean to provide a second function
like 'make_find_iterator_end(collection)' that returns a proper end
iterator but also to change the behaviour of iterators for
incrementation to the past-the-end value etc.!
I would really like to hear what Pavol says about that...
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk