Namespaces
Variants
Views
Actions

Talk:cpp/container/unordered map/erase

From cppreference.com

In the complexity section there are multiple references to "a.size()" without an explanation about "a". I suppose it is the unordered_map, but I think a more verbose name (like "unordered_map.size()" would be better here. 82.119.3.0 09:46, 7 May 2013 (PDT)

Thanks for pointing that out. P12 10:32, 7 May 2013 (PDT)

[edit] Note about end() iterator can't be used is confusing

'pos' and 'first' parameters must be valid and dereferenceable, but 'last' must be only valid, so it's possible to call m.erase(m.begin(), m.end());.

Good catch; I've updated the note to only talk about the pos iterator. --Nate 16:32, 28 July 2013 (PDT)

[edit] Note about example output

The output in the example is specified as 'two four six', but if you press "Run this code" it outputs 'six four two' with any of the compilers that accepts the code as-is. Per Malmberg (talk) 11:51, 6 February 2017 (PST)

good catch; the example was reusing code between map and unordered_map. I now made it say "Possible output" for unordered_map, so at least it is not wrong now. --Cubbi (talk) 12:30, 6 February 2017 (PST)