Add std::array hash

This commit is contained in:
Nikita Lisitsa 2025-07-12 01:28:14 +03:00
parent c3c8446431
commit 1f57c76036

View file

@ -1,6 +1,7 @@
#pragma once
#include <functional>
#include <array>
#include <tuple>
#include <cstdint>
@ -64,6 +65,20 @@ namespace std
}
};
template <typename T, std::size_t N>
struct hash<std::array<T, N>>
: std::hash<T>
{
using std::hash<T>::operator();
std::uint64_t operator()(std::array<T, N> const & x) const
{
std::uint64_t seed = 0;
::psemek::util::hash_sequence(seed, x.begin(), x.end(), *this);
return seed;
}
};
template <typename ... Ts>
struct hash<std::tuple<Ts...>>
: std::tuple<std::hash<Ts>...>