diff options
| author | Maxime Coste <mawww@kakoune.org> | 2022-08-05 19:20:00 +1000 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2022-08-05 19:20:00 +1000 |
| commit | 9fb7d90449ce798bbc014ac6d17261a9df5ee3f2 (patch) | |
| tree | 8983b0fa1b8c3a618e977e6df00914e4d6d56bb6 /src/hash_map.cc | |
| parent | 31e9fc3cefcbea03d4eaad75ed0dab3da8f3dc6f (diff) | |
Change HashMap not to support multiple identical keys by default
We do not seem to have any uses for this remaining, and this is
better opt-in with MultiHashMap
Diffstat (limited to 'src/hash_map.cc')
| -rw-r--r-- | src/hash_map.cc | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/hash_map.cc b/src/hash_map.cc index 4e45ab26..6972f34b 100644 --- a/src/hash_map.cc +++ b/src/hash_map.cc @@ -30,12 +30,23 @@ UnitTest test_hash_map{[] { kak_assert(map.size() == 2); } - // Multiple entries with the same key + // Replace Multiple entries with the same key { HashMap<int, int> map; map.insert({10, 1}); map.insert({10, 2}); kak_assert(map.find_index(10) == 0); + kak_assert(map[10] == 2); + map.remove(10); + kak_assert(map.find_index(10) == -1); + } + + // Multiple entries with the same key + { + MultiHashMap<int, int> map; + map.insert({10, 1}); + map.insert({10, 2}); + kak_assert(map.find_index(10) == 0); map.remove(10); kak_assert(map.find_index(10) == 0); map.remove(10); |
