Boost logo

Boost Users :

Subject: [Boost-users] [hash] hash returning fixed width integer instead of size_t?
From: Frédéric Bron (frederic.bron_at_[hidden])
Date: 2011-05-20 05:17:13


I would like this code return the same hash on different machines:

#include <iostream>
#include <boost/functional/hash.hpp>
int main() {
        boost::hash<std::string> hasher;
        std::cout<<hasher("abcd");
        return 0;
}

But I get 1244709680 when size_t is 32 bits and 706246339511088 when
size_t is 64 bits.
Is it possible to have hash work with fixed width uint32_t instead of size_t?

Frédéric


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net