Topic: Defect Report: A question of empty ranges
Author: Jeff Rife <wevsr@nabs.net>
Date: 1999/09/27 Raw View
Valentin Bonnard (Bonnard.V@wanadoo.fr) wrote:
> Proposed resolution:
>
> : -7- **If the container is not empty**, 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. The container is empty **iff** begin() == end();
Actually, it would be simpler to say:
: -7- end() returns an iterator which is the past-the-end value for the
: container. If the container is not empty, begin() returns an iterator
: referring to the first element in the container. If the container is
: empty, then begin() returns the same value as end().
--
Jeff Rife | "Wow, I've never seen you this
19445 Saint Johnsbury Lane | bitter...I like it."
Germantown, MD 20876-1610 | -- Richard Karinsky, "Caroline in the City"
Home: 301-916-8131 |
Work: 301-770-5800 Ext 5335 |
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: Valentin Bonnard <Bonnard.V@wanadoo.fr>
Date: 1999/09/27 Raw View
[First, a note about DR handling: since DR often generate discution
in csc++, I propose that the actual DR should only be sent to issue
list maintainer when such a discution ends (don't tell me that a ng
discution is never required to end), or after a resonable delay. Of
course, I propose that this new handling be applied to this message
first.]
Scope: library: container requirements
Type: editorial
While checking where the standard said that begin() == end() implies
empty() (it does in several places), I found the following:
: 23.1 [lib.container.requirements]
: -7- 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();
If the container is empty, there is no first element for begin()
to refer to !
Proposed resolution:
: -7- **If the container is not empty**, 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. The container is empty **iff** begin() == end();
Comment about proposed resolution:
The iff isn't actually required, but it doesn't hurt either
-- in particular it would help those who don't beleive that
begin() == end() implies empty().
--
Valentin Bonnard
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]