#include // minimal header providing phmap::HashState() #include #include #include #include #include #if PHMAP_HAVE_STD_STRING_VIEW #include #endif #include using std::string; using std::tuple; using std::pair; using groupid_t = std::array; namespace std { template<> struct hash { #if PHMAP_HAVE_STD_STRING_VIEW std::size_t operator()(groupid_t const &g) const { const std::string_view bv{reinterpret_cast(g.data()), sizeof(g)}; return std::hash()(bv); } #else std::size_t operator()(groupid_t const &g) const { return phmap::Hash()(std::tuple_cat(g)); } #endif }; } int main() { std::vector groups = { {17, 75, 82, 66}, {22, 88, 54, 42}, {11, 55, 77, 99} }; for (const auto &g : groups) std::cout << std::hash()(g) << '\n'; return 0; }