1210. Iterator reachability should not require a container

Section: 27.2 [iterator.requirements] Status: Resolved Submitter: Alisdair Meredith Opened: 2009-09-18 Last modified: 2016-02-10

Priority: Not Prioritized

View all other issues in [iterator.requirements].

View all issues with Resolved status.

Discussion:

p6 Iterator requirements 27.2 [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 27.2 [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.