This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/58153] unordered_multimap::erase(iterator) is not constant-time when many entries have the same key
- From: "temporal at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 24 Aug 2013 19:16:05 +0000
- Subject: [Bug libstdc++/58153] unordered_multimap::erase(iterator) is not constant-time when many entries have the same key
- Auto-submitted: auto-generated
- References: <bug-58153-4 at http dot gcc dot gnu dot org/bugzilla/>
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).