Subject: Re: [boost] [optional] operator<(optional<T>, T) -- is it wrong?
From: Stephan T. Lavavej (stl_at_[hidden])
Date: 2014-12-02 18:26:10
> I don't see why eg. std::hash<size_t> (or any smaller type)
> doesn't just return the bitwise equivalent of the original value by
> default, as this has zero collision probability and the highest performance.
Hashes are typically masked to get bucket indices, so hashing integers with the identity function allows collisions to be trivially generated, either intentionally or unintentionally. For example, 0x1000, 0x2000, 0x3000, 0x4000 are highly likely to collide, if the lower bits are being used to index buckets.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk