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

528. const_iterator iterator issue when they are the same type

Section: 24.5 [unord], 99 [tr.unord.unord] Status: NAD Submitter: Paolo Carlini Opened: 2005-10-12 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [unord].

View all issues with NAD status.


while implementing the resolution of issue 6.19 I'm noticing the following: according to (and, 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?

Proposed resolution:

Add to (and

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]

[ Post-Berlin: Beman supplied wording. ]


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.