44 bool (*) (
const void *,
void *),
64 void traverse (
bool (*fn) (
const void *,
T *,
void *),
void *
data);
73 n_slots = (size_t) 1 << log_slots;
75 slots = XCNEWVEC (
const void *, n_slots);
76 values = XNEWVEC (
T, n_slots);
103 template <
typename T>
112 if (n_elements > n_slots / 4)
114 size_t old_n_slots = n_slots;
115 const void **old_keys =
slots;
116 T *old_values = values;
117 log_slots = log_slots + 1;
118 n_slots = n_slots * 2;
119 slots = XCNEWVEC (
const void *, n_slots);
120 values = XNEWVEC (
T, n_slots);
121 for (
size_t i = 0; i < old_n_slots; ++i)
124 const void *key = old_keys[i];
127 values[n] = old_values[i];
129 XDELETEVEC (old_keys);
130 XDELETEVEC (old_values);
154 for (
size_t i = 0; i < n_slots; ++i)
155 if (
slots[i] && !fn (
slots[i], &values[i], data))
167 bool (*) (
const void *,
void **,
void *),
void *);