Go to the documentation of this file.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
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048 #ifndef __INTERPKERNELHASHFUN_HXX__
00049 #define __INTERPKERNELHASHFUN_HXX__
00050
00051 #include <cstddef>
00052
00053 namespace INTERP_KERNEL
00054 {
00055 template<class _Key>
00056 struct hash { };
00057
00058 inline std::size_t __stl_hash_string(const char* __s)
00059 {
00060 unsigned long __h = 0;
00061 for ( ; *__s; ++__s)
00062 __h = 5 * __h + *__s;
00063 return std::size_t(__h);
00064 }
00065
00066 template<>
00067 struct hash<char*>
00068 {
00069 std::size_t operator()(const char* __s) const
00070 { return __stl_hash_string(__s); }
00071 };
00072
00073 template<>
00074 struct hash<const char*>
00075 {
00076 std::size_t operator()(const char* __s) const
00077 { return __stl_hash_string(__s); }
00078 };
00079
00080 template<>
00081 struct hash<char>
00082 {
00083 std::size_t operator()(char __x) const { return __x; }
00084 };
00085
00086 template<>
00087 struct hash<unsigned char>
00088 {
00089 std::size_t operator()(unsigned char __x) const { return __x; }
00090 };
00091
00092 template<>
00093 struct hash<signed char>
00094 {
00095 std::size_t operator()(unsigned char __x) const { return __x; }
00096 };
00097
00098 template<>
00099 struct hash<short>
00100 {
00101 std::size_t operator()(short __x) const { return __x; }
00102 };
00103
00104 template<>
00105 struct hash<unsigned short>
00106 {
00107 std::size_t operator()(unsigned short __x) const { return __x; }
00108 };
00109
00110 template<>
00111 struct hash<int>
00112 {
00113 std::size_t operator()(int __x) const { return __x; }
00114 };
00115
00116 template<>
00117 struct hash<unsigned int>
00118 {
00119 std::size_t operator()(unsigned int __x) const { return __x; }
00120 };
00121
00122 template<>
00123 struct hash<long>
00124 {
00125 std::size_t operator()(long __x) const { return __x; }
00126 };
00127
00128 template<>
00129 struct hash<unsigned long>
00130 {
00131 std::size_t operator()(unsigned long __x) const { return __x; }
00132 };
00133 }
00134
00135 #endif