From 451d0f2fc5d5b43249a1aeb47450840505a79766 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sun, 30 Apr 2017 10:41:22 +0100 Subject: [PATCH] Constructing nodes is nothrow, so no need to track --- .../boost/unordered/detail/implementation.hpp | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/include/boost/unordered/detail/implementation.hpp b/include/boost/unordered/detail/implementation.hpp index 1a24c4c2..23098b43 100644 --- a/include/boost/unordered/detail/implementation.hpp +++ b/include/boost/unordered/detail/implementation.hpp @@ -1630,12 +1630,8 @@ template struct node_constructor node_allocator& alloc_; node_pointer node_; - bool node_constructed_; - node_constructor(node_allocator& n) - : alloc_(n), node_(), node_constructed_(false) - { - } + node_constructor(node_allocator& n) : alloc_(n), node_() {} ~node_constructor(); @@ -1644,7 +1640,7 @@ template struct node_constructor // no throw node_pointer release() { - BOOST_ASSERT(node_ && node_constructed_); + BOOST_ASSERT(node_); node_pointer p = node_; node_ = node_pointer(); return p; @@ -1654,7 +1650,6 @@ template struct node_constructor { BOOST_ASSERT(!node_); node_ = p; - node_constructed_ = true; BOOST_UNORDERED_CALL_DESTROY( node_allocator_traits, alloc_, node_->value_ptr()); } @@ -1667,10 +1662,7 @@ template struct node_constructor template node_constructor::~node_constructor() { if (node_) { - if (node_constructed_) { - boost::unordered::detail::func::destroy(boost::addressof(*node_)); - } - + boost::unordered::detail::func::destroy(boost::addressof(*node_)); node_allocator_traits::deallocate(alloc_, node_, 1); } } @@ -1678,12 +1670,8 @@ template node_constructor::~node_constructor() template void node_constructor::create_node() { BOOST_ASSERT(!node_); - node_constructed_ = false; - node_ = node_allocator_traits::allocate(alloc_, 1); - new (boost::addressof(*node_)) node(); - node_constructed_ = true; } template struct node_tmp