Created on 2015-09-16.00:00:00 last changed 89 months ago
Proposed resolution:
Change the insert-with-hint row in Table 102 Unordered associative container requirements like so:
a.insert( qp, t);iterator Requires: If t is a non-const
...Average Case
...
[ 2016-08 - Chicago ]
Thurs AM: Moved to Tentatively Ready
I have been wondering about the C++ standard requirements regarding the hint iterator for insertion into an unordered_multimap (and I imagine a similar question could be asked of unordered_map, but I have not researched that topic). As far as I can tell, it seems perfectly valid for an implementation to allow only valid dereferencable iterators to be used as the hint argument for this member function. If that is correct, it means that one could not expect the end iterator to be used as a valid hint nor could one use the begin iterator of an empty unordered_multimap as the hint. However, this essentially precludes all uses of inserter on an empty unordered_multimap seeing as the inserter functor requires that a hint iterator be passed to its constructor.
Howard Hinnant:The intent of the standard is that the iterator produced from container c by c.end() is a valid (but non-dereferenceable) iterator into container c. It is reachable by every other iterator into c.
It appears to me that you and the Bloomberg implementation have fallen victim to a type-o in the Unordered associative container requirements, Table 102. The row containing:a.insert(q, t);should read instead:
a.insert(p, t);The distinction is that p is valid, and q is both valid and dereferenceable. The correction of this type-o would make unordered container insert consistent with unordered emplace_hint, associative insert, and associative emplace_hint.
History | |||
---|---|---|---|
Date | User | Action | Args |
2017-07-30 20:15:43 | admin | set | status: wp -> c++17 |
2016-11-14 03:59:28 | admin | set | status: pending -> wp |
2016-11-14 03:55:22 | admin | set | status: ready -> pending |
2016-08-05 03:33:05 | admin | set | messages: + msg8412 |
2016-08-05 03:33:05 | admin | set | status: new -> ready |
2015-10-20 03:02:06 | admin | set | messages: + msg7572 |
2015-09-16 00:00:00 | admin | create |