27 #ifndef INCLUDED_ADTS_DYN_HASH_TBL
28 #define INCLUDED_ADTS_DYN_HASH_TBL
39 bool equal(Key k1, Key k2)
const;
51 bool equal(
const char* k1,
const char* k2)
const
53 return !strcmp(k1, k2);
63 template<
typename Key,
typename T,
typename Traits=DHT_Traits<Key,T> >
73 size_t hash =
tr.hash(key);
78 T& t =
tbl[hash & mask];
83 if(
tr.equal(key,
tr.get_key(t)))
98 throw std::bad_alloc();
211 return !(*
this == rhs);
215 iterator tmp = *
this; ++*
this;
return tmp;
238 #endif // #ifndef INCLUDED_ADTS_DYN_HASH_TBL
std::forward_iterator_tag iterator_category
size_t hash(Key key) const
const char * get_key(const char *t) const
ptrdiff_t difference_type
bool operator==(const iterator &rhs) const
#define SAFE_FREE(p)
free memory ensuing from malloc and set the pointer to zero (thus making double-frees safe / a no-op)...
bool equal(const char *k1, const char *k2) const
T & get_slot(Key key) const
#define ENSURE(expr)
ensure the expression <expr> evaluates to non-zero.
const T * operator->() const
size_t hash(const char *key) const
void insert(const Key key, const T t)
#define T(string_literal)
bool equal(Key k1, Key k2) const
static const size_t initial_entries
bool operator<(const iterator &rhs) const
iterator(T *pos_, T *end_)
u32 fnv_lc_hash(const char *str, size_t len)
special version of fnv_hash for strings: first converts to lowercase (useful for comparing mixed-case...
bool operator!=(const iterator &rhs) const