forked from boostorg/unordered
Unordered: And use allocator traits to destroy values.
[SVN r80222]
This commit is contained in:
@ -775,6 +775,12 @@ namespace boost { namespace unordered { namespace detail {
|
||||
address, boost::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
template <typename Alloc, typename T>
|
||||
inline void destroy_impl(Alloc& alloc, T* x) {
|
||||
boost::unordered::detail::allocator_traits<Alloc>::destroy(alloc, x);
|
||||
}
|
||||
|
||||
|
||||
# else
|
||||
|
||||
template <typename Alloc, typename T, typename... Args>
|
||||
@ -784,8 +790,21 @@ namespace boost { namespace unordered { namespace detail {
|
||||
new((void*) address) T(boost::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
template <typename Alloc, typename T>
|
||||
inline void destroy_impl(Alloc&, T* x) {
|
||||
boost::unordered::detail::destroy(x);
|
||||
}
|
||||
|
||||
|
||||
# endif
|
||||
|
||||
#else
|
||||
|
||||
template <typename Alloc, typename T>
|
||||
inline void destroy_impl(Alloc&, T* x) {
|
||||
boost::unordered::detail::destroy(x);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -112,7 +112,8 @@ namespace boost { namespace unordered { namespace detail {
|
||||
{
|
||||
if (node_) {
|
||||
if (value_constructed_) {
|
||||
boost::unordered::detail::destroy(node_->value_ptr());
|
||||
boost::unordered::detail::destroy_impl(alloc_,
|
||||
node_->value_ptr());
|
||||
}
|
||||
|
||||
if (node_constructed_) {
|
||||
@ -143,7 +144,8 @@ namespace boost { namespace unordered { namespace detail {
|
||||
|
||||
if (value_constructed_)
|
||||
{
|
||||
boost::unordered::detail::destroy(node_->value_ptr());
|
||||
boost::unordered::detail::destroy_impl(alloc_,
|
||||
node_->value_ptr());
|
||||
value_constructed_ = false;
|
||||
}
|
||||
}
|
||||
@ -762,7 +764,8 @@ namespace boost { namespace unordered { namespace detail {
|
||||
|
||||
inline void delete_node(c_iterator n)
|
||||
{
|
||||
boost::unordered::detail::destroy(n.node_->value_ptr());
|
||||
boost::unordered::detail::destroy_impl(node_alloc(),
|
||||
n.node_->value_ptr());
|
||||
node_allocator_traits::destroy(node_alloc(),
|
||||
boost::addressof(*n.node_));
|
||||
node_allocator_traits::deallocate(node_alloc(), n.node_, 1);
|
||||
|
Reference in New Issue
Block a user