Boost logo

Boost :

From: Yitzhak Sapir (yitzhaks_at_[hidden])
Date: 2002-10-14 03:39:11


On Mon, 14 Oct 2002, [iso-8859-1] Terje Slettebø wrote:

> >From: "David Abrahams" <dave_at_[hidden]>
>
> >Well, nothing needs to allow operations on end(), because nothing
> >forbids it. In general, the rule is: if the standard doesn't forbid
> >it, it is allowed.
>
> >That aside, the implementation of reverse_iterator is clearly spelled
> >out in the standard:
>
> > [lib.reverse.iter.op++]
> > 24.4.1.3.5 operator++
> > reverse_iterator& operator++();
> > 1 Effects: --current;
>
> >So, Terje's argument holds water.
>
> I think there might have been a mixup in the quoting here, as the argument
> that operator--() is safe, because of the requirement that you can do
> reverse_iterator(c.end()), was by Yitzhak, not me. Although I've come to
> that I agree. :)

I just asked the question, I didn't know the answer, and didn't provide it
(although I had ideas). Anyway, now, if I write a bidirectional iterator,
does a standard bidirectional iterator (ie, a bidirectional iterator as
defined by the standard) me to provide such an implementation such that,
"if x == end(), and the sequence in question is non empty, --x provides a
valid iterator to the element before the end"? This essentially means
that I can't use "end marker" iterators without providing for this special
case (which I didn't realize I had to do until now).


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk