7 #ifndef ELM_UTIL_HASH_KEY_H
8 #define ELM_UTIL_HASH_KEY_H
10 #include <elm/types.h>
11 #include <elm/string.h>
12 #include <elm/util/Option.h>
28 static inline bool equals(
const T& key1,
const T& key2) {
return &key1 == &key2 ||
hash_equals(&key1, &key2,
sizeof(T)); }
31 template <
class T>
class HashKey<const T&> {
34 static inline bool equals(
const T& key1,
const T& key2) {
return &key1 == &key2 ||
hash_equals(&key1, &key2,
sizeof(T)); }
40 static inline bool equals(
const T& key1,
const T& key2) {
return &key1 == &key2 ||
hash_equals(&key1, &key2,
sizeof(T)); }
47 static inline t::hash hash(
int key) {
return (
unsigned long)key; }
48 static inline bool equals(
int key1,
int key2) {
return key1 == key2; }
54 static inline bool equals(
void *key1,
void *key2) {
return key1 == key2; }
60 static inline bool equals(
const void *key1,
const void *key2)
61 {
return key1 == key2; }
69 {
return key1 == key2; }
77 {
return key1 == key2; };
82 #endif // ELM_UTIL_HASH_KEY_H
static bool equals(const T &key1, const T &key2)
Definition: HashKey.h:40
static t::hash hash(int key)
Definition: HashKey.h:47
static bool equals(const T &key1, const T &key2)
Definition: HashKey.h:34
uint32 size
Definition: int.h:41
static bool equals(const T &key1, const T &key2)
Definition: HashKey.h:28
static t::hash hash(CString key)
Definition: HashKey.h:66
bool hash_equals(const void *p1, const void *p2, int size)
Definition: util_HashKey.cpp:100
const char * chars(void) const
Definition: String.h:74
static bool equals(const String &key1, const String &key2)
Definition: HashKey.h:76
static t::hash hash(const T &key)
Definition: HashKey.h:39
static t::hash hash(const T &key)
Definition: HashKey.h:27
static bool equals(void *key1, void *key2)
Definition: HashKey.h:54
int length(void) const
Definition: String.h:73
static t::hash hash(const T &key)
Definition: HashKey.h:33
t::intptr hash
Definition: HashKey.h:16
t::hash hash_jenkins(const void *block, int size)
Definition: util_HashKey.cpp:44
static t::hash hash(const String &key)
Definition: HashKey.h:74
t::hash hash_string(const char *chars, int length)
Definition: util_HashKey.cpp:63
static t::hash hash(void *key)
Definition: HashKey.h:53
static bool equals(CString key1, CString key2)
Definition: HashKey.h:68
uint32 intptr
Definition: int.h:44
static bool equals(int key1, int key2)
Definition: HashKey.h:48
static bool equals(const void *key1, const void *key2)
Definition: HashKey.h:60
static t::hash hash(const void *key)
Definition: HashKey.h:59
t::hash hash_cstring(const char *chars)
Definition: util_HashKey.cpp:80