
In-Reply-To: <001001c529b2$4841da80$6501a8c0@pdimov2> pdimov@mmltd.net (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