新微赢技术网
标题:
[求助]hash_map
[打印本页]
作者:
爱虎老油♂
时间:
2009-11-6 00:15
标题:
[求助]hash_map
[求助]有关hashhash函数如下:
#include <hash_map>
//#include<hash_map.h>
using namespace std;
struct calc_hash{
int operator()(string str)const{
int h = 0, g,i;
for (i = 0; i < str.size(); i++) {
h = (h << 4) + str[i];
if ((g = (h & 0xF0000000))) {
h = h ^ (g >> 24);
h = h ^ g;
}
}
return h;
}
};
如何在vc or vc.net里用hash_map?
typedef hash_map<string, int, str_hash> Mymap;//出现编译错误。。。
typedef hash_map<string,int, hash_compare<string,less<string> > Myhash;//不晓得如何修改。怎解?
欢迎光临 新微赢技术网 (http://bbs.weiying.cn/)
Powered by Discuz! X3.2