Add std::array hash
This commit is contained in:
parent
c3c8446431
commit
1f57c76036
1 changed files with 15 additions and 0 deletions
|
|
@ -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>...>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue