Boost logo

Boost :

From: Dave Harris (brangdon_at_[hidden])
Date: 2005-03-16 12:07:14


In-Reply-To: <001001c529b2$4841da80$6501a8c0_at_pdimov2>
pdimov_at_[hidden] (Peter Dimov) wrote (abridged):
> Alignment is only going to be a problem if the lower sizeof(size_t) *
> CHAR_BIT bits of the value produced by reinterpret_cast do not contain
> enough entropy. I think that in practice the hash function will be good
> enough.

It partly depends on how the hash_value is used. If the value is always a
multiple of 8, say, and it is used with a bucket count which is a power of
2, then only 1 out of every 8 buckets will get used. Entropy in the higher
bits doesn't help.

You may be assuming that no-one will use a bucket count which is not a
prime number. I'd rather not make that assumption if we can reasonably
avoid it.

It shouldn't matter if the values are pushed through hash_combine a few
times, but that might not always happen.

-- Dave Harris, Nottingham, UK


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk