10template <
typename K,
typename T,
12 bool KEEP_HISTORY =
false,
int LG = 20>
15 int index = get_index(k);
20 if constexpr (KEEP_HISTORY) {
21 history.push_back(index);
26 constexpr bool erase(
const K &k) {
27 int index = get_index(k);
35 int index = get_index(k);
40 requires requires(F f,
const K &k, T &v) { f(k, v); }
42 if constexpr (KEEP_HISTORY) {
43 for (
int i : history) {
49 for (
int i = 0; i < MOD; i++) {
58 if constexpr (KEEP_HISTORY) {
59 for (
int i : history) {
69 static constexpr int MOD = 1 << LG;
75 constexpr int get_index(
const K &k)
const {
76 unsigned long long hash = Hash()(k);
77 int index = hash >> (64 - LG);
78 while (vis[index] && key[index] != k) {
79 index = (index + 1) & (MOD - 1);
Definition hashmap.hpp:13
constexpr bool contains(const K &k) const
Definition hashmap.hpp:34
constexpr T & operator[](const K &k)
Definition hashmap.hpp:14
constexpr bool erase(const K &k)
Definition hashmap.hpp:26
constexpr void for_each(F f)
Definition hashmap.hpp:41
constexpr void clear()
Definition hashmap.hpp:57
Definition hashing.hpp:73