Refactor node_handle's clear() member function to reset()

This commit is contained in:
Christian Mazakas
2023-02-19 21:13:02 -08:00
parent b08810c0c4
commit 5986f75d16
3 changed files with 6 additions and 6 deletions

View File

@ -86,7 +86,7 @@ struct node_handle_base
x.p=nullptr; x.p=nullptr;
} }
void clear() void reset()
{ {
al().~Allocator(); al().~Allocator();
p_=nullptr; p_=nullptr;
@ -99,7 +99,7 @@ struct node_handle_base
{ {
if (!nh.empty()){ if (!nh.empty()){
emplace(nh.p_,nh.al()); emplace(nh.p_,nh.al());
nh.clear(); nh.reset();
} }
} }
@ -138,7 +138,7 @@ struct node_handle_base
{ {
if(!empty()){ if(!empty()){
type_policy::destroy(al(),p_); type_policy::destroy(al(),p_);
a_.t_.~Allocator(); reset();
} }
} }

View File

@ -403,11 +403,11 @@ namespace boost {
BOOST_ASSERT(get_allocator() == nh.get_allocator()); BOOST_ASSERT(get_allocator() == nh.get_allocator());
typename map_types::element_type x; typename map_types::element_type x;
x.p=std::addressof(nh.element()); x.p = std::addressof(nh.element());
auto itp = table_.insert(std::move(x)); auto itp = table_.insert(std::move(x));
if (itp.second) { if (itp.second) {
nh.clear(); nh.reset();
return {itp.first, true, node_type{}}; return {itp.first, true, node_type{}};
} else { } else {
return {itp.first, false, std::move(nh)}; return {itp.first, false, std::move(nh)};

View File

@ -395,7 +395,7 @@ namespace boost {
auto itp = table_.insert(std::move(x)); auto itp = table_.insert(std::move(x));
if (itp.second) { if (itp.second) {
nh.clear(); nh.reset();
return {itp.first, true, node_type{}}; return {itp.first, true, node_type{}};
} else { } else {
return {itp.first, false, std::move(nh)}; return {itp.first, false, std::move(nh)};