#include <bits/stdc++.h>
struct hash_pair {
template <class T1, class T2>
size_t operator()(const std::pair<T1, T2>& p) const
{
size_t hash1 = std::hash<T1>()(p.first);
auto hash2 = std::hash<T2>{}(p.second);
if (hash1 != hash2) {
return hash1 ^ hash2;
}
// If hash1 == hash2, their XOR is zero.
return hash1;
}
};
int main(int argc, char** argv)
{
std::unordered_map<std::pair<std::string, std::string>, int, hash_pair> map;
return 0;
}
'C++' 카테고리의 다른 글
[C++] smart pointer ---> unique_ptr (0) | 2023.07.08 |
---|---|
[C++] reference (참조자, 레퍼런스) (0) | 2023.07.08 |
[C++] namespace (이름공간) (0) | 2023.07.08 |