This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of New status.
Section: 18.104.22.168 [associative.reqmts.general], 22.214.171.124 [unord.req.general] Status: New Submitter: Jens Maurer Opened: 2022-04-19 Last modified: 2022-05-17
View other active issues in [associative.reqmts.general].
View all other issues in [associative.reqmts.general].
View all issues with New status.
Keys for elements of associative containers are presented as const subobjects, preventing their modification by user code according to 126.96.36.199 [dcl.type.cv] p4.However, that does not prevent those keys to be transparently replaced, for example via
std::map<int, int> map; map.emplace(1, 2); using KT = std::map<int, int>::key_type; auto it = map.begin(); it->first.~KT(); new (const_cast<int*>(&it->first)) KT(3);
This, of course, breaks the ordering of the keys, and should be undefined behavior.Related issue: CWG 2514.
[2022-05-17; Reflector poll]
Set priority to 3 after reflector poll. One vote for NAD.
This wording is relative to N4910.
Modify 188.8.131.52 [associative.reqmts.general] as indicated:
-5- For set and multiset the value type is the same as the key type. For map and multimap it is equal to pair<const Key, T>.
Modify 184.108.40.206 [unord.req.general] as indicated:
-7- For unordered_set and unordered_multiset the value type is the same as the key type. For unordered_map and unordered_multimap it is pair<const Key, T>.