-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathKey.h
More file actions
39 lines (31 loc) · 706 Bytes
/
Key.h
File metadata and controls
39 lines (31 loc) · 706 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//
// Created by kosti on 10/20/2018.
//
#ifndef UNTITLED_KEY_H
#define UNTITLED_KEY_H
#include <iostream>
#include <vector>
struct Key {
std::vector<int> dim ;
long int hash_val;
bool operator==(const Key& lhs) const
{
if (lhs.dim.size() != dim.size()) return false;
for (int i = 0 ; i < lhs.dim.size() ; i++) {
if (lhs.dim[i]!=dim[i]){
return false;
}
}
return true;
}
};
namespace std {
template<>
struct hash<Key> {
size_t operator()(const Key &k) const {
cout << "THE REAL " << k.hash_val << endl;
return k.hash_val;
}
};
};
#endif //UNTITLED_KEY_H