diff options
| author | Maxime Coste <mawww@kakoune.org> | 2023-05-29 20:08:02 +1000 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2023-05-29 20:11:06 +1000 |
| commit | cf7c6380254c7c2733952d2899761a2afc881b44 (patch) | |
| tree | 7e1dd924a2c37fb34063ae7d3e9e2668f036ec2a /src/hash_map.hh | |
| parent | 3069b68245a0bd5451fac33a56097eb7c9351975 (diff) | |
Refactor KeymapManager to enfore setting is_executing on key iteration
Add an iterator based remove to HashMap as that was missing. Make
KeymapManager responsible for throwing on unmap an executing mapping.
Diffstat (limited to 'src/hash_map.hh')
| -rw-r--r-- | src/hash_map.hh | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/hash_map.hh b/src/hash_map.hh index 5fad3235..4c1f258f 100644 --- a/src/hash_map.hh +++ b/src/hash_map.hh @@ -328,6 +328,15 @@ struct HashMap return const_cast<HashMap*>(this)->find(key); } + constexpr void remove(const const_iterator& it) + { + auto index = it - m_items.begin(); + const auto hash = hash_value(it->key); + m_index.remove(hash, index); + m_items.erase(it); + m_index.ordered_fix_entries(index); + } + constexpr void clear() { m_items.clear(); m_index.clear(); } constexpr size_t size() const { return m_items.size(); } |
