On Mon, Mar 24, 2003 at 11:46:50AM +0100, Alfredo Braunstein wrote:
> >> Who's talking about pointers? The standard doesn't, am I right?
> > 
> > Oh, it does. But not necessarily in connection with iterators ;-)
> 
> The original point in question was if the iterator rend() points to the
> start or one-before-start of the container.
> 
> What's the/your definition of the word 'points' for an interator in this
> frase? I've always assumed that "pa points to a, and *pa is allowed" iff
> "*pa gives a".

I do the same. But using this definition it is hard to distinguish between
a pointer (as in "something that point to something") and a pointer (as
defined by the Standard). But these is the price for sloppiness I suppose.

> But you have a different definition it seems, you say that rend() points to
> the first element of the container. What's yours/the right one?

A reverse_iterator is a wrapper around an iterator (accessible by calling
rit.base()).  In case of  rend() the "embedded" iterator is build from
begin(), not begin() - 1.  "build from" means in all implementations I am
aware of "is a copy of".

As the iterator usually is a pointer (notice my own sloppiness again), I
felt like saying "rend() is a pointer to the first element".

The -1 is added only when dereferencing the reverse_iterator, nowhere else.

Andre'

-- 
Those who desire to give up Freedom in order to gain Security,
will not have, nor do they deserve, either one. (T. Jefferson)

Reply via email to