[求助]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;//不晓得如何修改。怎解?