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

1210. Iterator reachability should not require a container

Section: 24.3 [iterator.requirements] Status: Resolved Submitter: Alisdair Meredith Opened: 2009-09-18 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [iterator.requirements].

View all issues with Resolved status.

Discussion:

p6 Iterator requirements 24.3 [iterator.requirements]

An iterator j is called reachable from an iterator i if and only if there is a finite sequence of applications of the expression ++i that makes i == j. If j is reachable from i, they refer to the same container.

A good example would be stream iterators, which do not refer to a container. Typically, the end iterator from a range of stream iterators will compare equal for many such ranges. I suggest striking the second sentence.

An alternative wording might be:

If j is reachable from i, and both i and j are dereferencable iterators, then they refer to the same range.

[ 2010 Pittsburgh: Moved to NAD EditorialResolved. Rationale added below. ]

Rationale:

Solved by N3066.

Proposed resolution:

Change 24.3 [iterator.requirements], p6:

An iterator j is called reachable from an iterator i if and only if there is a finite sequence of applications of the expression ++i that makes i == j. If j is reachable from i, they refer to the same container.