This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [v3] tr1::array fixups
- From: Sashan Govender <sashang at gmail dot com>
- To: Paolo Carlini <pcarlini at suse dot de>
- Cc: Benjamin Kosnik <bkoz at redhat dot com>, libstdc++ at gcc dot gnu dot org
- Date: Sun, 17 Oct 2004 09:34:45 +1300
- Subject: Re: [v3] tr1::array fixups
- Domainkey-signature: a=rsa-sha1; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=LZ+yxwoPeSTlg2W4VQnFM3EnnDrt3JyW1+4JezKfP59euoqTZ1jS5BEGHvhLG+AMjaCYen9PRdgfRqIu/O/yp1bT5W/5x0c3lt0nbfCOkjLlZaBABU3WaeX80uH+4gLNzyNB3N+rkQKOip+2/S3CspYIbhEVCwgjoEK6oSpxzGI
- References: <20041016085055.6e041852.bkoz@redhat.com> <41716717.8090104@suse.de>
- Reply-to: Sashan Govender <sashang at gmail dot com>
On Sat, 16 Oct 2004 20:23:19 +0200, Paolo Carlini <pcarlini@suse.de> wrote:
> Benjamin Kosnik wrote:
>
> > const_iterator
> > end() const
> >! { return reinterpret_cast<iterator>(&_M_instance[_S_index - 1]); }
> >
> By the way, a few days ago, I have noticed that end() - beg() == size()
> - 1 != size(),
> I think this is not ok: end() should point one-past-end, as always
> happens with the
> other containers...
>
> Wouldn't be better just using (_M_instance + _S_index) ??
>
> Paolo.
>
Yeah - I agree that it should point to one past the end since that is
how other container types behave. I checked the C++ standard
[lib.container.requirements] and it has this to say
"begin() returns an iterator referring to the first element in the
container. end() returns an iterator which is the past-the-end value
for the container. If the container is empty, then begin() == end();"