Add hash for std::pair
This commit is contained in:
parent
fa581d0ed3
commit
ef80db2620
1 changed files with 13 additions and 0 deletions
|
|
@ -32,6 +32,19 @@ namespace psemek::util
|
|||
namespace std
|
||||
{
|
||||
|
||||
template <typename T, typename H>
|
||||
struct hash<std::pair<T, H>>
|
||||
: std::pair<std::hash<T>, std::hash<H>>
|
||||
{
|
||||
std::size_t operator()(std::pair<T, H> const & x) const
|
||||
{
|
||||
std::size_t seed = 0;
|
||||
::psemek::util::hash_combine(seed, this->first(x.first));
|
||||
::psemek::util::hash_combine(seed, this->second(x.second));
|
||||
return seed;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename ... Ts>
|
||||
struct hash<std::tuple<Ts...>>
|
||||
: std::tuple<std::hash<Ts>...>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue