Boost logo

Boost :

From: Terje Slettebø (tslettebo_at_[hidden])
Date: 2002-10-14 05:52:45


>From: "Yitzhak Sapir" <yitzhaks_at_[hidden]>

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

>> >From: "David Abrahams" <dave_at_[hidden]>
>>
>> >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).

Opps, right, it was Joe who had the argument.

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

That's how I understand it, yes.

23/9 says, "If the iterator type of a container belongs to the bidirectional
or random access iterator categories (24.1), the container is called
reversible and satisfies the additional requirements in Table 66:"

Among them are:

"a.rbegin()", which should give the effect of "reverse_iterator(end())".

reverse_iterator() takes an iterator in the constructor, and its
operator++() definition is quoted above, by Dave.

Regards,

Terje


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