HashMap.h

Go to the documentation of this file.
00001 
00020 #ifndef HYPERTABLE_HASHMAP_H
00021 #define HYPERTABLE_HASHMAP_H
00022 
00023 #include <boost/config.hpp>
00024 #include BOOST_HASH_MAP_HEADER
00025 #include BOOST_HASH_SET_HEADER
00026 
00027 #include "MurmurHash.h"
00028 
00029 namespace BOOST_STD_EXTENSION_NAMESPACE {
00030   template<> struct hash<std::string>  {
00031     size_t operator()(const std::string &x) const {
00032       return Hypertable::murmurhash2(x.data(), x.length(), 0);
00033     }
00034   };
00035 #if defined(__APPLE__) || defined(__i386__)
00036   template<> struct hash<uint64_t> {
00037     size_t operator()(const uint64_t val) const {
00038       return size_t(val);
00039     }
00040   };
00041 
00042   template<> struct hash<int64_t> {
00043     size_t operator()(const int64_t val) const {
00044       return size_t(val);
00045     }
00046   };
00047 #endif
00048 }
00049 
00050 namespace Hypertable {
00051   // import hash_map/set into our namespace
00052   using BOOST_STD_EXTENSION_NAMESPACE::hash_map;
00053   using BOOST_STD_EXTENSION_NAMESPACE::hash_set;
00054 } // namespace Hypertable
00055 
00056 #endif // HYPERTABLE_HASHMAP_H