I should probably mirror unordered_set, shouldn't I? In
sparse_hash_set, ++ is constant-time, so there's no reason not to
support it, even if the spec doesn't require it. For dense_hash_set,
it's a different story.
I agree with the "Toronto consensus" that if needed, the iterator
could be its own proxy. I may do that for dense_hash_map; it adds a
bit of code complexity, but not that much.
craig
In the situation you describe, you can get around the cost of it++ by
calling erase(*it) instead of erase(it). It means an extra hash, but
if that's faster than the ++it it may be a better choice.
craig
------- Comment #10 From Paolo Carlini 2009-11-29 08:34 [reply]
-------
Stefan is right. The issue, in full generality, isn't trivial at all,
there is
now a new discussion on the library reflector. I'm under the
impression that
for C++0x we are not going to standardize the minimum load factor
suggested by
Matt, seems much more likely that erase will be just changed to return
void,
there is a growing consensus about that.
Thanks for the update.
craig
> This is a temporary workaround for the inefficient erase method. Hopefully, in a future version the signature of erase will be changed and this will be deprecated.
Cheers,
Shaun
It looks as though GCC will follow the lead of boost, adding a
function erase_return_void. Perhaps Google sparsehash could follow
suit.
Cheers,
Shaun
It sounds like things are still in flux. I'm going to wait for
everything to settle down a bit before changing sparsehash.
craig