Title
Unnecessary restriction on past-the-end iterators
Status
tc1
Section
[iterator.concepts]
Submitter
Stephen Cleary

Created on 2000-02-02.00:00:00 last changed 171 months ago

Messages

Date: 2010-10-21.18:28:33

Rationale:

For some kinds of containers, including singly linked lists and zero-length vectors, null pointers are perfectly reasonable past-the-end iterators. Null pointers are singular.

Date: 2010-10-21.18:28:33

Proposed resolution:

Change [iterator.concepts] paragraph 5, the last sentence, from:

Dereferenceable and past-the-end values are always non-singular.

to:

Dereferenceable values are always non-singular. 

Date: 2000-02-02.00:00:00

In 24.1 paragraph 5, it is stated ". . . Dereferenceable and past-the-end values are always non-singular."

This places an unnecessary restriction on past-the-end iterators for containers with forward iterators (for example, a singly-linked list). If the past-the-end value on such a container was a well-known singular value, it would still satisfy all forward iterator requirements.

Removing this restriction would allow, for example, a singly-linked list without a "footer" node.

This would have an impact on existing code that expects past-the-end iterators obtained from different (generic) containers being not equal.

History
Date User Action Args
2010-10-21 18:28:33adminsetmessages: + msg1862
2010-10-21 18:28:33adminsetmessages: + msg1861
2000-02-02 00:00:00admincreate