注册 登录
编程论坛 C++教室

unordered_map问题。。。。。

lzd0507 发布于 2012-04-10 20:58, 802 次点击
用unordered_map替换map:
typedef pair<int,int> RolePair;
typedef pair<RolePair,double> DisPair;
//function object
class DisSortCriterion
{
public:
bool operator()(const DisPair& left, const DisPair& right)const
{
if( left.second > right.second )
return true;
return false;
}
};
typedef multiset<DisPair,DisSortCriterion> Mapping;
typedef set<int> AgentSet;
typedef map<AgentSet,Mapping> HashMap;
请问各位大神怎么实现···就是hasher::hash function 怎么实现。。。希望具体点啊··初学者··请多指教···
2 回复
#2
rjsp2012-04-11 08:23
你在搞什么东西,尤其是 HashMap,其类型竟然是 map<set<int>,Mapping>,你会用一个set作为key吗?

http://
#3
lzd05072012-04-12 20:02
回复 2楼 rjsp
这···我定义的hashMap只是map的一个变量,不是具体的hashmap,它只是个变量名而已啊···我写的那个定义是完全没有错误的啊···问题的关键是在于unordered_map中hash函数啊··大神,不要这样攻击我啊···
1