forked from boostorg/unordered
Add missing empty_ initialization to move constructor of node_type
This commit is contained in:
@ -79,7 +79,7 @@ namespace boost {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class A>
|
template <class A>
|
||||||
static void construct(A&, element_type* p, element_type&& x)
|
static void construct(A&, element_type* p, element_type&& x) noexcept
|
||||||
{
|
{
|
||||||
p->p = x.p;
|
p->p = x.p;
|
||||||
x.p = nullptr;
|
x.p = nullptr;
|
||||||
@ -171,10 +171,15 @@ namespace boost {
|
|||||||
|
|
||||||
node_handle(node_handle&& nh) noexcept
|
node_handle(node_handle&& nh) noexcept
|
||||||
{
|
{
|
||||||
|
// neither of these move constructors are allowed to throw exceptions
|
||||||
|
// so we can get away with rote placement new
|
||||||
|
//
|
||||||
new (a) Allocator(std::move(nh.al()));
|
new (a) Allocator(std::move(nh.al()));
|
||||||
type_policy::construct(al(), reinterpret_cast<element_type*>(x),
|
type_policy::construct(al(), reinterpret_cast<element_type*>(x),
|
||||||
type_policy::move(nh.element()));
|
type_policy::move(nh.element()));
|
||||||
|
|
||||||
|
empty_ = false;
|
||||||
|
|
||||||
reinterpret_cast<Allocator*>(nh.a)->~Allocator();
|
reinterpret_cast<Allocator*>(nh.a)->~Allocator();
|
||||||
nh.empty_ = true;
|
nh.empty_ = true;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user