Boost logo

Boost :

Subject: [boost] [functional/hash] integer hash function
From: Tim Blechmann (tim_at_[hidden])
Date: 2011-10-04 16:03:09


i was quite amazed that the default hash function for integers seems to be the
identity function:

from boost/functional/hash/hash.hpp:
    inline std::size_t hash_value(int v)
    {
        return static_cast<std::size_t>(v);
    }

while this is probably the most efficient hash function, it is also the worst
possible. is this done intentionally?

tim


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