From: Dave Harris (brangdon_at_[hidden])
Date: 2005-03-19 12:21:14
pdimov_at_[hidden] (Peter Dimov) wrote (abridged):
> Had you written your hash function following the guideline that every
> member that is part of the state and affects the equivalence relation
> needs to be hash_combined when computing the hash value, you'd not have
> had collisions.
That's good advice, but wouldn't have helped much with my code for other
reasons, which I've explained in a parallel post. Remember I was not using
the proposed boost functions.
> In other words, making hash_value take into account the type of the
> member is not necessary for writing good quality hash functions. It
> will only "fix" some (questionably written) functions, but not all.
I agree it's not necessary in that the same result can be achieved in a
different way. And that's a powerful argument :-)
Still, throwing away the type information will reduce the available
entropy when the types are different. That it won't when the types are the
same is no reason not to take advantage of that variation when it is
-- 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