This page is a snapshot from the LWG issues list, see theLibrary Active Issues List for more information and the meaning ofC++11 status.
iterator andconst_iteratorSection: 23.2.7[associative.reqmts]Status:C++11Submitter: Alisdair MeredithOpened: 2009-03-12Last modified: 2016-01-28
Priority:Not Prioritized
View otheractive issues in [associative.reqmts].
View all otherissues in [associative.reqmts].
View all issues withC++11 status.
Discussion:
Addresses UK 238 [CD1]
Leaving it unspecified whether or notiterator andconst_iterator are thesame type is dangerous, as user code may or may not violate the OneDefinition Rule by providing overloads for both types. It is probably too late to specify a single behaviour, butimplementors should document what to expect. Observing that problems can beavoided by users restricting themselves to usingconst_iterator, add a note to that effect.
Suggest Change 'unspecified' to 'implementation defined'.
[Summit:]
Agree with issue. Agree with adding the note but not with changing thenormative text. We believe the note provides sufficient guidance.
[Batavia (2009-05):]
We agree with the proposed resolution.Move to Tentatively Ready.
Proposed resolution:
In 23.2.7[associative.reqmts] p6, add:
-6-
iteratorof an associative container meets the requirementsof theBidirectionalIteratorconcept. For associativecontainers where the value type is the same as the key type, bothiteratorandconst_iteratorare constant iterators. Itis unspecified whether or notiteratorandconst_iteratorare the same type.[Note:iteratorandconst_iteratorhave identical semantics inthis case, anditeratoris convertible toconst_iterator. Users can avoidviolating the One Definition Rule by always usingconst_iteratorin their function parameter lists-- end note]