36 #ifndef LIBUTILITIES_BASICUTILS_HASHUTILS
37 #define LIBUTILITIES_BASICUTILS_HASHUTILS
39 #include <boost/core/ignore_unused.hpp>
48 boost::ignore_unused(seed);
51 template <
typename T,
typename... Args>
52 inline void hash_combine(std::size_t& seed,
const T& v, Args... args)
55 seed ^= hasher(v) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
59 template <
typename T,
typename... Args>
62 boost::ignore_unused(v);
68 template<
typename Iter>
72 for(; first != last; ++first)
79 template<
typename Iter>
80 void hash_range(std::size_t &seed, Iter first, Iter last)
90 return static_cast<std::size_t
>(t);
95 template <
class T1,
class T2>
99 auto h1 = std::hash<T1>{}(
p.first);
100 auto h2 = std::hash<T2>{}(
p.second);
The above copyright notice and this permission notice shall be included.
std::size_t hash_range(Iter first, Iter last)
void hash_combine(std::size_t &seed)
std::size_t operator()(T t) const
std::size_t operator()(const std::pair< T1, T2 > &p) const