00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #ifndef _CPP_BITS_STL_HASH_FUN_H
00032 #define _CPP_BITS_STL_HASH_FUN_H 1
00033
00034 #include <bits/std_cstddef.h>
00035
00036 namespace std
00037 {
00038
00039 template <class _Key> struct hash { };
00040
00041 inline size_t __stl_hash_string(const char* __s)
00042 {
00043 unsigned long __h = 0;
00044 for ( ; *__s; ++__s)
00045 __h = 5*__h + *__s;
00046
00047 return size_t(__h);
00048 }
00049
00050 template<> struct hash<char*>
00051 {
00052 size_t operator()(const char* __s) const { return __stl_hash_string(__s); }
00053 };
00054
00055 template<> struct hash<const char*>
00056 {
00057 size_t operator()(const char* __s) const { return __stl_hash_string(__s); }
00058 };
00059
00060 template<> struct hash<char> {
00061 size_t operator()(char __x) const { return __x; }
00062 };
00063 template<> struct hash<unsigned char> {
00064 size_t operator()(unsigned char __x) const { return __x; }
00065 };
00066 template<> struct hash<signed char> {
00067 size_t operator()(unsigned char __x) const { return __x; }
00068 };
00069 template<> struct hash<short> {
00070 size_t operator()(short __x) const { return __x; }
00071 };
00072 template<> struct hash<unsigned short> {
00073 size_t operator()(unsigned short __x) const { return __x; }
00074 };
00075 template<> struct hash<int> {
00076 size_t operator()(int __x) const { return __x; }
00077 };
00078 template<> struct hash<unsigned int> {
00079 size_t operator()(unsigned int __x) const { return __x; }
00080 };
00081 template<> struct hash<long> {
00082 size_t operator()(long __x) const { return __x; }
00083 };
00084 template<> struct hash<unsigned long> {
00085 size_t operator()(unsigned long __x) const { return __x; }
00086 };
00087
00088 }
00089
00090 #endif
00091
00092
00093
00094