00001 #ifndef _MY_StringHashFun_
00002 #define _MY_StringHashFun_
00003
00004 #include <string>
00005 #include <string.h>
00006 using std::string;
00007 #include <ext/hash_map>
00011 class StringHashFun : public __gnu_cxx::hash<const char* >
00012 {
00013 public:
00014
00015 size_t operator()(const std::string &x) const
00016 {
00017 __gnu_cxx::hash<const char* > f;
00018 return f(x.c_str());
00019 }
00020
00021 };
00022
00023 struct eqstr
00024 {
00025 bool operator()(const std::string &s1, const std::string &s2) const
00026 {
00027 return strcmp(s1.c_str(), s2.c_str()) == 0;
00028 }
00029 };
00030
00031
00032 typedef __gnu_cxx::hash_map<string,string,StringHashFun,struct eqstr> Dictionary;
00033
00034
00035 #endif