#pragma once #include namespace std { namespace { template void hash_combine(size_t& seed, const T& value) { seed ^= std::hash()(value) + 0x9e3779b9 + (seed << 6) + (seed >> 2); } // Recursive template code derived from Matthieu M. template ::value - 1> struct HashValueImpl { static void apply(size_t& seed, const Tuple& tuple) { HashValueImpl::apply(seed, tuple); hash_combine(seed, std::get(tuple)); } }; template struct HashValueImpl { static void apply(size_t& seed, const Tuple& tuple) { hash_combine(seed, std::get<0>(tuple)); } }; } template struct hash> { size_t operator()(const tuple& tt) const { size_t seed = 0; HashValueImpl >::apply(seed, tt); return seed; } }; }