hash_map中string为key的解决方法(二)

2014-11-24 08:50:54 · 作者: · 浏览: 1
template<>
struct hash
{
size_t operator()(unsigned long long __x) const
{
if (sizeof(__x) == sizeof(size_t))
return __x;
else
return (__x >> 32) ^ (__x & 0xFFFFFFFF);
}
};

template
struct hash >
{
size_t operator()(const std::basic_string& __s) const
{
return __stl_hash_string(__s.c_str());
}
};

}
#endif

#endif//EXT_HASH_FUNCTION_HPP_INCLUDED