Namespaces
Variants
Views
Actions

Talk:cpp/container/unordered map/insert

From cppreference.com

[edit] Iterator Invalidation

The standard defines (23.5.4.4):

Effects: Inserts obj converted to value_type if and only if there is no element in the container with key equivalent to the key of value_type(obj).

— Preceding unsigned comment added by ReDucTor (talkcontribs)

Can you elaborate? What is incorrect, and how? T. Canens (talk) 18:57, 11 January 2016 (PST)
"If rehashing occurs due to the insertion, all iterators are invalidated. Otherwise iterators are not affected. " This statement is incorrect. Iterators are not invalidated. --ReDucTor (talk) 13:03, 12 January 2016 (PST)
No, it's correct as written. [unord.req]/9, 14-15. T. Canens (talk) 13:26, 12 January 2016 (PST)
Thanks, I missed this. However looking at MSVC and libcxx implementations they both appear (Didn't look to deep) to have a single linked list that is iterated, but libstdc++ has a linked list per bucket that would be invalidated. --ReDucTor (talk) 14:44, 12 January 2016 (PST)