Implement initial draft of heterogeneous extract()

This commit is contained in:
LeonineKing1199
2021-12-06 13:06:05 -08:00
parent 00b504ebc5
commit 13cd5aa4ce
3 changed files with 127 additions and 7 deletions
@@ -3655,14 +3655,15 @@ namespace boost {
// Extract and erase
inline node_pointer extract_by_key(const_key_type& k)
template <class Key> node_pointer extract_by_key_impl(Key const& k)
{
if (!this->size_) {
return node_pointer();
}
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(this->key_eq(), k, bucket_index);
if (!prev) {
return node_pointer();
}
@@ -3679,6 +3680,11 @@ namespace boost {
return n;
}
inline node_pointer extract_by_key(const_key_type& k)
{
return extract_by_key_impl(k);
}
// Reserve and rehash
void reserve_for_insert(std::size_t);