This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of TC1 status.

208. Unnecessary restriction on past-the-end iterators

Section: 25.3.4 [iterator.concepts] Status: TC1 Submitter: Stephen Cleary Opened: 2000-02-02 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [iterator.concepts].

View all issues with TC1 status.

Discussion:

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.

Proposed resolution:

Change 25.3.4 [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. 

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.