Title
const_iterator iterator issue when they are the same type
Status
nad
Section
[unord][tr.unord.unord]
Submitter
Paolo Carlini

Created on 2005-10-12.00:00:00 last changed 160 months ago

Messages

Date: 2011-03-05.00:04:13

Rationale:

Toronto: The first issue has been fixed by N2350 (the insert and erase members are collapsed into one signature). Alisdair to open a separate issue on the chapter 17 wording.

Date: 2010-10-21.18:28:33

[ Post-Berlin: Beman supplied wording. ]

Date: 2010-10-21.18:28:33

Proposed resolution:

Add to 6.3.4.3p2 (and 6.3.4.5p2):

2 ... The iterator and const_iterator types are both const constant iterator types. It is unspecified whether they are the same type.

Add a new subsection to 17.4.4 [lib.conforming]:

An implementation shall not supply an overloaded function signature specified in any library clause if such a signature would be inherently ambiguous during overload resolution due to two library types referring to the same type.

[Note: For example, this occurs when a container's iterator and const_iterator types are the same. -- end note]

Date: 2005-10-12.00:00:00

while implementing the resolution of issue 6.19 I'm noticing the following: according to 6.3.4.3/2 (and 6.3.4.5/2), for unordered_set and unordered_multiset:

"The iterator and const_iterator types are both const types. It is unspecified whether they are the same type"

Now, according to the resolution of 6.19, we have overloads of insert with hint and erase (single and range) both for iterator and const_iterator, which, AFAICS, can be meaningful at the same time *only* if iterator and const_iterator *are* in fact different types.

Then, iterator and const_iterator are *required* to be different types? Or that is an unintended consequence? Maybe the overloads for plain iterators should be added only to unordered_map and unordered_multimap? Or, of course, I'm missing something?

History
Date User Action Args
2011-03-05 00:04:13adminsetmessages: + msg5578
2010-10-21 18:28:33adminsetmessages: + msg2956
2010-10-21 18:28:33adminsetmessages: + msg2955
2005-10-12 00:00:00admincreate