diff --git a/src/hash.hh b/src/hash.hh index 3fc8abd2..896478f3 100644 --- a/src/hash.hh +++ b/src/hash.hh @@ -31,12 +31,16 @@ size_t hash_values(Type&& t) return hash_value(std::forward(t)); } +inline size_t combine_hash(size_t lhs, size_t rhs) +{ + return lhs ^ (rhs + 0x9e3779b9 + (lhs << 6) + (lhs >> 2)); +} + template size_t hash_values(Type&& t, RemainingTypes&&... rt) { size_t seed = hash_values(std::forward(rt)...); - return seed ^ (hash_value(std::forward(t)) + 0x9e3779b9 + - (seed << 6) + (seed >> 2)); + return combine_hash(seed, hash_value(std::forward(t))); } template