[Bug libstdc++/58153] unordered_multimap::erase(iterator) is not constant-time when many entries have the same key

temporal at gmail dot com gcc-bugzilla@gcc.gnu.org
Sat Aug 24 19:16:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58153

--- Comment #4 from Kenton Varda <temporal at gmail dot com> ---
> This report entry made me wonder why iterators could not just be
> pointing to the node just before the one containing the pointed to value.

That's a neat idea.

I think there is an obscure issue, though.  If I have an iterator pointing at
item N, and then I (separately) erase item N - 1, what happens to my iterator?

But you bring up another, simpler point:  why not just have an erase_after()
method like forward_list does?  That would suit my use case (although at this
point I've rewritten it to do something different).



More information about the Gcc-bugs mailing list