mirror of
https://github.com/boostorg/unordered.git
synced 2025-07-30 03:17:15 +02:00
micro-optimized table destruction
This commit is contained in:
@ -1123,8 +1123,7 @@ public:
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
BOOST_CATCH(...){
|
BOOST_CATCH(...){
|
||||||
clear();
|
destroy();
|
||||||
delete_arrays(arrays);
|
|
||||||
BOOST_RETHROW
|
BOOST_RETHROW
|
||||||
}
|
}
|
||||||
BOOST_CATCH_END
|
BOOST_CATCH_END
|
||||||
@ -1153,9 +1152,8 @@ public:
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
BOOST_CATCH(...){
|
BOOST_CATCH(...){
|
||||||
clear();
|
|
||||||
delete_arrays(arrays);
|
|
||||||
x.clear();
|
x.clear();
|
||||||
|
destroy();
|
||||||
BOOST_RETHROW
|
BOOST_RETHROW
|
||||||
}
|
}
|
||||||
BOOST_CATCH_END
|
BOOST_CATCH_END
|
||||||
@ -1165,8 +1163,7 @@ public:
|
|||||||
|
|
||||||
~table()noexcept
|
~table()noexcept
|
||||||
{
|
{
|
||||||
clear();
|
destroy();
|
||||||
delete_arrays(arrays);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
table& operator=(const table& x)
|
table& operator=(const table& x)
|
||||||
@ -1458,6 +1455,14 @@ private:
|
|||||||
Allocator& al(){return allocator_base::get();}
|
Allocator& al(){return allocator_base::get();}
|
||||||
const Allocator& al()const{return allocator_base::get();}
|
const Allocator& al()const{return allocator_base::get();}
|
||||||
|
|
||||||
|
void destroy()noexcept
|
||||||
|
{
|
||||||
|
for_all_elements([this](value_type* p){
|
||||||
|
destroy_element(p);
|
||||||
|
});
|
||||||
|
delete_arrays(arrays);
|
||||||
|
}
|
||||||
|
|
||||||
arrays_type new_arrays(std::size_t n)
|
arrays_type new_arrays(std::size_t n)
|
||||||
{
|
{
|
||||||
return arrays_type::new_(al(),n);
|
return arrays_type::new_(al(),n);
|
||||||
|
Reference in New Issue
Block a user