Maestro 0.3.11
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
16namespace Utils
17{
18
19// or simply use boost::hash
20template <typename T1, typename T2 = T1> class PairHash
21{
22 public:
23 size_t operator()(const std::pair<T1, T2> &p) const
24 {
25 const auto h1 = std::hash<T1>{}(p.first);
26 const auto h2 = std::hash<T2>{}(p.second);
27
28 // alternative with boost combine:
29 /*
30 std::size_t seed = 0;
31 boost::hash_combine(seed, h1);
32 boost::hash_combine(seed, h1);
33
34 return seed;
35 */
36
37 return (h1 << 5) ^ h2;
38 }
39};
40
41} // namespace Utils
42
43#endif
size_t operator()(const std::pair< T1, T2 > &p) const
Definition PairHash.h:23
Portable dense contraction kernels.