From 3414e6628add93a2bef3c647dbb7c4d73c3d0f7e Mon Sep 17 00:00:00 2001 From: Daniel James Date: Tue, 18 Apr 2017 10:14:26 +0100 Subject: [PATCH] Use allocator to construct/destroy nodes --- .../boost/unordered/detail/implementation.hpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/include/boost/unordered/detail/implementation.hpp b/include/boost/unordered/detail/implementation.hpp index e49fe4d7..4741170a 100644 --- a/include/boost/unordered/detail/implementation.hpp +++ b/include/boost/unordered/detail/implementation.hpp @@ -1659,7 +1659,8 @@ template node_constructor::~node_constructor() { if (node_) { if (node_constructed_) { - boost::unordered::detail::func::destroy(boost::addressof(*node_)); + BOOST_UNORDERED_CALL_DESTROY( + node_allocator_traits, alloc_, boost::addressof(*node_)); } node_allocator_traits::deallocate(alloc_, node_, 1); @@ -1673,7 +1674,8 @@ template void node_constructor::create_node() node_ = node_allocator_traits::allocate(alloc_, 1); - new ((void*)boost::addressof(*node_)) node(); + BOOST_UNORDERED_CALL_CONSTRUCT0( + node_allocator_traits, alloc_, boost::addressof(*node_)); node_->init(node_); node_constructed_ = true; } @@ -1705,7 +1707,8 @@ template node_tmp::~node_tmp() if (node_) { BOOST_UNORDERED_CALL_DESTROY( node_allocator_traits, alloc_, node_->value_ptr()); - boost::unordered::detail::func::destroy(boost::addressof(*node_)); + BOOST_UNORDERED_CALL_DESTROY( + node_allocator_traits, alloc_, boost::addressof(*node_)); node_allocator_traits::deallocate(alloc_, node_, 1); } } @@ -2209,7 +2212,8 @@ template node_holder::~node_holder() BOOST_UNORDERED_CALL_DESTROY( node_allocator_traits, constructor_.alloc_, p->value_ptr()); - boost::unordered::detail::func::destroy(boost::addressof(*p)); + BOOST_UNORDERED_CALL_DESTROY( + node_allocator_traits, constructor_.alloc_, boost::addressof(*p)); node_allocator_traits::deallocate(constructor_.alloc_, p, 1); } } @@ -3009,7 +3013,8 @@ struct table : boost::unordered::detail::functionsvalue_ptr()); - boost::unordered::detail::func::destroy(boost::addressof(*n)); + BOOST_UNORDERED_CALL_DESTROY( + node_allocator_traits, node_alloc(), boost::addressof(*n)); node_allocator_traits::deallocate(node_alloc(), n, 1); --size_; } @@ -3037,7 +3042,8 @@ struct table : boost::unordered::detail::functions(get_bucket(bucket_count_)->next_); - boost::unordered::detail::func::destroy(boost::addressof(*n)); + BOOST_UNORDERED_CALL_DESTROY( + node_allocator_traits, node_alloc(), boost::addressof(*n)); node_allocator_traits::deallocate(node_alloc(), n, 1); }