33 template<
class K>
struct Equal {
bool operator()(
const K& k1,
const K& k2)
const {
return k1 == k2; } };
36 template<
class K>
struct DeepEqual {
bool operator()(
const K* k1,
const K* k2)
const {
return *k1 == *k2; } };
38 static inline uint32_t
hash(uint32_t x){
return x; }
39 static inline uint32_t
hash(uint64_t x){
return (uint32_t)x; }
40 static inline uint32_t
hash(int32_t x) {
return (uint32_t)x; }
41 static inline uint32_t
hash(int64_t x) {
return (uint32_t)x; }
49 static const int primes [
nprimes] = { 31, 73, 151, 313, 643, 1291, 2593, 5233, 10501, 21013, 42073, 84181, 168451, 337219, 674701, 1349473, 2699299, 5398891, 10798093, 21596719, 43193641, 86387383, 172775299, 345550609, 691101253 };
55 template<
class K,
class D,
class H = Hash<K>,
class E = Equal<K> >
84 for (
int i = 1; newsize <=
cap && i <
nprimes; i++)
90 for (
int i = 0; i < old_cap; i++){
91 for (
int j = 0; j < old[i].
size(); j++){
112 for (
int i = 0; i < ps.
size(); i++)
125 for (
int i = 0; i < ps.
size(); i++)
134 bool peek (
const K& k, D& d)
const {
135 if (
size == 0)
return false;
137 for (
int i = 0; i < ps.
size(); i++)
144 bool has (
const K& k)
const {
145 if (
size == 0)
return false;
147 for (
int i = 0; i < ps.
size(); i++)
154 void remove(
const K& k) {
176 delete [] other.
table;
void insert(const K &k, const D &d)
const vec< Pair > & bucket(int i) const
Map(const H &h, const E &e)
Map< K, D, H, E > & operator=(Map< K, D, H, E > &other)
bool operator()(const K &k1, const K &k2) const
Map(Map< K, D, H, E > &other)
bool operator()(const K *k1, const K *k2) const
const D & operator[](const K &k) const
bool checkCap(int new_size) const
bool peek(const K &k, D &d) const
static uint32_t hash(uint32_t x)
int32_t index(const K &k) const
uint32_t operator()(const K *k) const
void _insert(const K &k, const D &d)
bool has(const K &k) const
uint32_t operator()(const K &k) const
const T & last(void) const
static const int primes[nprimes]