From 85cb09ae6de04a9a09b4d93bc88d9be588793db4 Mon Sep 17 00:00:00 2001 From: Christian Mazakas Date: Tue, 21 Dec 2021 09:20:40 -0800 Subject: [PATCH] Add `erase_key_equiv_impl()` member function --- include/boost/unordered/detail/implementation.hpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/include/boost/unordered/detail/implementation.hpp b/include/boost/unordered/detail/implementation.hpp index e1cfc2e7..23c4314a 100644 --- a/include/boost/unordered/detail/implementation.hpp +++ b/include/boost/unordered/detail/implementation.hpp @@ -3800,14 +3800,16 @@ namespace boost { // // no throw - std::size_t erase_key_equiv(const_key_type& k) + template + std::size_t erase_key_equiv_impl(KeyEqual const& key_eq, Key const& k) { if (!this->size_) return 0; - std::size_t key_hash = this->hash(k); + std::size_t key_hash = policy::apply_hash(this->hash_function(), k); std::size_t bucket_index = this->hash_to_bucket(key_hash); - link_pointer prev = this->find_previous_node(k, bucket_index); + link_pointer prev = + this->find_previous_node_impl(key_eq, k, bucket_index); if (!prev) return 0; @@ -3825,6 +3827,11 @@ namespace boost { return deleted_count; } + std::size_t erase_key_equiv(const_key_type& k) + { + return this->erase_key_equiv_impl(this->key_eq(), k); + } + link_pointer erase_nodes_equiv(node_pointer i, node_pointer j) { std::size_t bucket_index = this->node_bucket(i);