Well, just do it like the boost guys did it:
template <class T>
inline void hash_combine(std::size_t& seed, const T& v)
{
std::hash<T> hasher;
seed ^= hasher(v) + 0x9e3779b9 + (seed<<6) + (seed>>2);
}
More Related Contents:
- Sorting zipped (locked) containers in C++ using boost or the STL
- C++ – Why is boost::hash_combine the best way to combine hash-values?
- Hash an arbitrary precision value (boost::multiprecision::cpp_int)
- What does the namespace std add? (C++) [closed]
- Converting std::__cxx11::string to std::string
- Flattening iterator
- Magic number in boost::hash_combine
- Why is the destructor of a future returned from `std::async` blocking?
- What can and can’t I specialize in the std namespace?
- Should we pass a shared_ptr by reference or by value?
- How to convert std::chrono::time_point to calendar datetime string with fractional seconds?
- Which Boost features overlap with C++11?
- How to use std::async on a member function?
- Doing a static_assert that a template type is another template
- std::bind overload resolution
- std::put_time implementation status in GCC?
- What is the default hash function used in C++ std::unordered_map?
- C++ Add months to chrono::system_clock::time_point
- Is it smart to replace boost::thread and boost::mutex with c++11 equivalents?
- Why would I ever use push_back instead of emplace_back?
- Passing rvalues through std::bind
- How do I erase elements from STL containers?
- C++11 equivalent to boost shared_mutex
- std::thread error (thread not member of std)
- std::remove_const with const references
- Comparing 3 modern c++ ways to convert integral values to strings
- When must you pass io_context to boost::asio::spawn? (C++)
- std::tuple get() member function
- Assert that code does NOT compile
- map with incomplete value type