65,189
社区成员




#include <hash_map>
#include <string>
#include <iostream>
using namespace std;
/**
* 哈希表中的有用数据,即每个词项
*/
typedef struct TermStr
{
string key;
int frequency;
} Term;
struct str_hash{
size_t operator()(const string& str) const
{
return __stl_hash_string(str.c_str());
}
};
struct compare_str{
bool operator()(Term p1, Term p2) const{
return (p1.key == p2.key);
}
};
typedef hash_map<string, Term, str_hash, compare_str> hashMap;