On Mon, Mar 24, 2003 at 09:56:56AM +0100, Alfredo Braunstein wrote: > > Wrong. rend is a wrapper around begin(). It _cannot_ be a pointer to "one > > before start", as already forming such a pointer is illegal. Not the > > difference to the "one past" which can legally be formed, but not > > dereferenced. > > That all wrong, AFAIK.
If you say so. > From where do you have taken it? Chapter 23, Containers library. Note that it does not say that rbegin() be a wrapper around end(), but that's the obvious way to handle it. > rend is _not_ a wrapper around begin, it point to 'one before start'. > And rbegin points to the last element, not to one past end. As you are seemingly a big fan of things that "just work": From the g++ 2.95.3 implementation of reverse_iterator: template <class _Iterator> class reverse_iterator { protected: _Iterator current; [...] explicit reverse_iterator(iterator_type __x) : current(__x) {} [...] reference operator*() const { _Iterator __tmp = current; return *--__tmp; } }; and from vector: reverse_iterator rbegin() { return reverse_iterator(end()); } const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); } reverse_iterator rend() { return reverse_iterator(begin()); } const_reverse_iterator rend() const { return const_reverse_iterator(begin()); } Andre', obviously wrong. -- Those who desire to give up Freedom in order to gain Security, will not have, nor do they deserve, either one. (T. Jefferson)