用于
unordered_map<PII, int>
型
#include<bits/stdc++.h>
using namespace std;
struct hashfunc
{
size_t operator() (const pair<int, int> &i) const
{
//将键中的两个数返回为hash值
return i.first*i.second;
}
};
unordered_map< pair<int, int>, int , hashfunc > mp;
int main() {
mp[{1,2}]=3;
mp[{2,2}]=12;
cout<<mp[{1,2}];
return 0;
}