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

407. Can singular iterators be destroyed?

Section: 25.3.4 [iterator.concepts] Status: CD1 Submitter: Nathan Myers Opened: 2003-06-03 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [iterator.concepts].

View all issues with CD1 status.

Discussion:

Clause 25.3.4 [iterator.concepts], paragraph 5, says that the only expression that is defined for a singular iterator is "an assignment of a non-singular value to an iterator that holds a singular value". This means that destroying a singular iterator (e.g. letting an automatic variable go out of scope) is technically undefined behavior. This seems overly strict, and probably unintentional.

Proposed resolution:

Change the sentence in question to "... the only exceptions are destroying an iterator that holds a singular value, or the assignment of a non-singular value to an iterator that holds a singular value."