Boost logo

Boost :

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


In-Reply-To: <d19tal$32u$1_at_[hidden]>
daniel_at_[hidden] (Daniel James) wrote (abridged):
> We can't tell if it was correct, because you didn't specify the
> equality function for the type.

Err, I wasn't asking you whether it was correct. I'm not asking for
assistance with that old code; I found and fixed the problems long ago.

I mentioned this stuff only because it is part of my background and
experience, which the formal review guidelines say should be included in
the review.

> But the point is, if the types are right, then Peter's
> proposal is ideal in this situation.

As I said, the main problem was that my primitive hash_values often
produced zero, and my combine function combined zeroes into zeroes.
Combining a bool doesn't help when the bool itself hashes to zero.

Another problem is that in some places I was using a version of
hash_combine that wasn't order-dependant. The original boost proposal was
better in that respect.

Even fixing those issues, you really only get one additional bit of
entropy by including the bool. You get slightly more entropy if you
include the types as well. Sometimes every little helps. Especially if the
hash_combine function isn't of cryptographic strength.

> And it wasn't actually correct (with the current interface)

It wasn't using the current interface - it wasn't using boost at all. The
actual function wasn't even called hash_value. I translated my functions
into the proposed terminology rather than explain my terminology.

-- 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