can anyone tell me how to make a custom hash for an — ↵
↵
unordered_set< pair < unordered_set<vector< int > , hashFunction > , vector< int> > > > ↵
↵
where hashFunction is a custom hashFunction for unordered_set<vector<int>> . ↵
↵
here it is — ↵
↵
↵
struct hashFunction //hash function for unordered set<int>↵
↵
{↵
↵
size_t operator()(const vector<int> &myVector) const↵
↵
{↵
std::hash<int> hasher;↵
size_t answer = 0;↵
↵
for (int i : myVector)↵
{↵
answer ^= hasher(i) + 0x9e3779b9 +↵
(answer << 6) + (answer >> 2);↵
}↵
return answer;↵
}↵
};
↵
unordered_set< pair < unordered_set<vector< int > , hashFunction > , vector< int
↵
where hashFunction is a custom hashFunction for unordered_set<vector<int>> . ↵
↵
here it is — ↵
↵
↵
struct hashFunction //hash function for unordered set<int>↵
↵
{↵
↵
size_t operator()(const vector<int> &myVector) const↵
↵
{↵
std::hash<int> hasher;↵
size_t answer = 0;↵
↵
for (int i : myVector)↵
{↵
answer ^= hasher(i) + 0x9e3779b9 +↵
(answer << 6) + (answer >> 2);↵
}↵
return answer;↵
}↵
};