mirror of
https://github.com/boostorg/unordered.git
synced 2025-07-31 11:57:15 +02:00
Refactor node_handle's clear() member function to reset()
This commit is contained in:
@ -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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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)};
|
||||||
|
@ -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)};
|
||||||
|
Reference in New Issue
Block a user