Boost logo

Boost Users :

From: Daniel James (daniel_at_[hidden])
Date: 2005-04-05 12:04:21


Martin Wartens wrote:
> Back to the main topic: I find it quite unsatisfiying that there is seems to be
> no way to avoid searching for the same position twice
> ("get_bucket", "find_iterator").

The only thing I can think of within TR1 would be to cache the result of
the previous search - but that would be very wasteful for any other
situation.

> I don't see where the hint-version of insert
> could be of any use

I think its main use is inserting from a range - if equivalent values
are adjacent there will be a slight speed up (depends on the hash
function and equality functions).

> especially since the standard says "Implementations are
> permitted to ignore the hint". I would need a function like "insert_if" taking
> a predicate that decides whether to insert when an object with the same key
> already exists.

If you have a problem with TR1, you be better of posting to comp.std.c++
or similar. I'm not going to implement any extensions without a very
good reason. Sorry.

Are you sure that searching twice is really hurting performance? With a
good hash function it shouldn't take long at all.

Daniel


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net