Add member function template find_previous_node_impl so it can be used in heterogenous contexts

This commit is contained in:
LeonineKing1199
2021-12-02 15:30:17 -08:00
parent a98a719546
commit 03edf7f4a8

View File

@ -3618,9 +3618,9 @@ namespace boost {
} }
} }
// Find the node before the key, so that it can be erased. template <class KeyEqual, class Key>
link_pointer find_previous_node( link_pointer find_previous_node_impl(
const_key_type& k, std::size_t bucket_index) KeyEqual const& eq, Key const& k, std::size_t const bucket_index)
{ {
link_pointer prev = this->get_previous_start(bucket_index); link_pointer prev = this->get_previous_start(bucket_index);
if (!prev) { if (!prev) {
@ -3634,7 +3634,7 @@ namespace boost {
} else if (n->is_first_in_group()) { } else if (n->is_first_in_group()) {
if (node_bucket(n) != bucket_index) { if (node_bucket(n) != bucket_index) {
return link_pointer(); return link_pointer();
} else if (this->key_eq()(k, this->get_key(n))) { } else if (eq(k, this->get_key(n))) {
return prev; return prev;
} }
} }
@ -3642,6 +3642,13 @@ namespace boost {
} }
} }
// Find the node before the key, so that it can be erased.
link_pointer find_previous_node(
const_key_type& k, std::size_t bucket_index)
{
return find_previous_node_impl(this->key_eq(), k, bucket_index);
}
// Extract and erase // Extract and erase
inline node_pointer extract_by_key(const_key_type& k) inline node_pointer extract_by_key(const_key_type& k)