10#ifndef TEUCHOS_HASHUTILS_H
11#define TEUCHOS_HASHUTILS_H
39 static int getHashCode(
const unsigned char *
a,
size_t len);
45 static const int primeCount_;
46 static const int primes_[];
71 template <>
inline int hashCode(
const unsigned& x)
74 reinterpret_cast<const unsigned char *
>(&x),
sizeof(
unsigned));
80 template <>
inline int hashCode(
const double& x)
83 reinterpret_cast<const unsigned char *
>(&x),
sizeof(
double));
97 template <>
inline int hashCode(
const long long& x)
100 reinterpret_cast<const unsigned char *
>(&x),
sizeof(
long long));
109 reinterpret_cast<const unsigned char *
>(&x),
sizeof(
long));
115 template <>
inline int hashCode(
const std::string& x)
120 const char*
str = x.c_str();
121 int len =
static_cast<int>(x.length());
122 int step =
len/4 + 1;
126 for (
int i=0;
i<
len/2;
i+=step)
Teuchos header file which uses auto-configuration information to include necessary C++ headers.
Utilities for generating hashcodes. This is not a true hash ! For all ints and types less than ints i...
int hashCode(const T &x)
Standard interface for getting the hash code of an object.
int hashCode(const std::string &x)
Get the hash code of a std::string.
int hashCode(const double &x)
Get the hash code of a double.
int hashCode(const long &x)
Get the hash code of a long.
static int getHashCode(const unsigned char *a, size_t len)
int hashCode(const long long &x)
Get the hash code of a long long.
int hashCode(const int &x)
Get the hash code of an int.
int hashCode(const unsigned &x)
Get the hash code of an unsigned.
int hashCode(const bool &x)
Get the hash code of a bool.
Smart reference counting pointer class for automatic garbage collection.
The Teuchos namespace contains all of the classes, structs and enums used by Teuchos,...