Maestro
0.1.0
Unified interface for quantum circuit simulation
Loading...
Searching...
No Matches
PairHash.h
Go to the documentation of this file.
1
10
11
#pragma once
12
13
#ifndef _PAIR_HASH_H_
14
#define _PAIR_HASH_H_
15
16
namespace
Utils
{
17
18
// or simply use boost::hash
19
template
<
typename
T1,
typename
T2 = T1>
class
PairHash
{
20
public
:
21
size_t
operator()
(
const
std::pair<T1, T2> &p)
const
{
22
const
auto
h1 = std::hash<T1>{}(p.first);
23
const
auto
h2 = std::hash<T2>{}(p.second);
24
25
// alternative with boost combine:
26
/*
27
std::size_t seed = 0;
28
boost::hash_combine(seed, h1);
29
boost::hash_combine(seed, h1);
30
31
return seed;
32
*/
33
34
return
(h1 << 5) ^ h2;
35
}
36
};
37
38
}
// namespace Utils
39
40
#endif
Utils::PairHash
Definition
PairHash.h:19
Utils::PairHash::operator()
size_t operator()(const std::pair< T1, T2 > &p) const
Definition
PairHash.h:21
Utils
Definition
Alias.h:20
Utils
PairHash.h
Generated on
for Maestro by
1.15.0