Movatterモバイル変換


[0]ホーム

URL:



This page is a snapshot from the LWG issues list, see theLibrary Active Issues List for more information and the meaning ofC++11 status.

1040. Clarify possible sameness of associative container'siterator andconst_iterator

Section: 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-iterator of an associative container meets the requirementsof theBidirectionalIterator concept. For associativecontainers where the value type is the same as the key type, bothiterator andconst_iterator are constant iterators. Itis unspecified whether or notiterator andconst_iterator are the same type.[Note:iterator andconst_iterator have identical semantics inthis case, anditerator is convertible toconst_iterator. Users can avoidviolating the One Definition Rule by always usingconst_iteratorin their function parameter lists-- end note]


[8]ページ先頭

©2009-2026 Movatter.jp