From 71bf336c9dca1c51c3149e3cae09c44638ce2d58 Mon Sep 17 00:00:00 2001 From: Christian Mazakas Date: Tue, 7 Feb 2023 10:08:58 -0800 Subject: [PATCH] Add missing empty_ initialization to move constructor of node_type --- include/boost/unordered/unordered_node_map.hpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/boost/unordered/unordered_node_map.hpp b/include/boost/unordered/unordered_node_map.hpp index c215f4f3..9d046861 100644 --- a/include/boost/unordered/unordered_node_map.hpp +++ b/include/boost/unordered/unordered_node_map.hpp @@ -79,7 +79,7 @@ namespace boost { } template - 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; x.p = nullptr; @@ -171,10 +171,15 @@ namespace boost { 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())); type_policy::construct(al(), reinterpret_cast(x), type_policy::move(nh.element())); + empty_ = false; + reinterpret_cast(nh.a)->~Allocator(); nh.empty_ = true; }