42 #ifndef TEUCHOS_HASHUTILS_H 43 #define TEUCHOS_HASHUTILS_H 64 static int nextPrime(
int newCapacity);
71 static const int primes_[];
82 template <
class T>
int hashCode(
const T& x);
95 template <>
inline int hashCode(
const double& x)
111 template <>
inline int hashCode(
const long long& x)
127 template <>
inline int hashCode(
const std::string& x)
129 const char* str = x.c_str();
130 int len = x.length();
131 int step = len/4 + 1;
135 for (
int i=0; i<len/2; i+=step)
137 rtn += base*(int) str[i];
139 rtn += base*(int) str[len-i-1];
149 #endif // TEUCHOS_HASHUTILS_H int hashCode(const double &x)
Get the hash code of a double.
int hashCode(const std::string &x)
Get the hash code of a std::string.
Utilities for generating hashcodes.
Teuchos header file which uses auto-configuration information to include necessary C++ headers...
int hashCode(const long &x)
Get the hash code of a long.
int hashCode(const int &x)
Get the hash code of an int.
#define TEUCHOSCORE_LIB_DLL_EXPORT
static const int primeCount_
int hashCode(const long long &x)
Get the hash code of a long long.
int hashCode(const bool &x)
Get the hash code of a bool.