Boost logo

Boost :

From: Dan W. (danw_at_[hidden])
Date: 2004-01-02 14:56:56

Jeremy Maitin-Shepard wrote:

> The behavior of rehash in the case that an exception is thrown by the
> hash function is not specified in the proposal. In this
> implementation, if an exception is thrown by a hash function during a
> rehash operation, the hash table is cleared. This appears to be better
> behavior than leaving the container in state where it contains an
> arbitrary set of elements.

I was afraid of expressing my opinion until I saw it expressed by David
Abrahams.. ;-) Either the user has a catch for such an exeption or she
doesn't. If she doesn't (the most likely scenario) the app will crash so
who cares? If she does, she may decide that the operation wasn't all
that important anyways, or that it was caused by a bad alloc so she
might free some old caches and try it again.

But I was posting for another reason: I have working code using SGI's
hash_map<>, and it relies on an assumption I was under the impression
was safe to make, namely that hash_map<> guarantees that iterators are
not invalidated by insertion or deletion of elements.
But I spent the night reading through the proposal, and some of the
implementations it allows would cause re-hashings. Does this mean my
beautiful code is as good as toast? >:~(

I'm begging on my knees for a change to the proposal that would allow me
to use a fixed number of buckets: 4096, thank you... ;-)

Boost list run by bdawes at, gregod at, cpdaniel at, john at