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