truct hash_map_func
... {
enum
...{ // parameters for hash table
bucket_size = 2, // 0 < bucket_size
min_buckets = 8
}; // min_buckets = 2 ^^ N, 0 < N
size_t operator()(const string& str)const
...{
const char* p =str.c_str();
unsigned long hash = 5381;
int c;
while (c = *p++)
hash = ((hash << 5) + hash) + c; /**//* hash * 33 + c */
return hash;
}
bool operator()(const string& _Keyval1, const string& _Keyval2) const
...{ // test if _Keyval1 ordered before _Keyval2
return (gt(_Keyval1, _Keyval2));
}
greater<string> gt;
} ;
... {
enum
...{ // parameters for hash table
bucket_size = 2, // 0 < bucket_size
min_buckets = 8
}; // min_buckets = 2 ^^ N, 0 < N
size_t operator()(const string& str)const
...{
const char* p =str.c_str();
unsigned long hash = 5381;
int c;
while (c = *p++)
hash = ((hash << 5) + hash) + c; /**//* hash * 33 + c */
return hash;
}
bool operator()(const string& _Keyval1, const string& _Keyval2) const
...{ // test if _Keyval1 ordered before _Keyval2
return (gt(_Keyval1, _Keyval2));
}
greater<string> gt;
} ;