|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r80222 - trunk/boost/unordered/detail
From: dnljms_at_[hidden]
Date: 2012-08-25 17:53:26
Author: danieljames
Date: 2012-08-25 17:53:25 EDT (Sat, 25 Aug 2012)
New Revision: 80222
URL: http://svn.boost.org/trac/boost/changeset/80222
Log:
Unordered: And use allocator traits to destroy values.
Text files modified:
trunk/boost/unordered/detail/allocate.hpp | 19 +++++++++++++++++++
trunk/boost/unordered/detail/buckets.hpp | 9 ++++++---
2 files changed, 25 insertions(+), 3 deletions(-)
Modified: trunk/boost/unordered/detail/allocate.hpp
==============================================================================
--- trunk/boost/unordered/detail/allocate.hpp (original)
+++ trunk/boost/unordered/detail/allocate.hpp 2012-08-25 17:53:25 EDT (Sat, 25 Aug 2012)
@@ -775,6 +775,12 @@
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 @@
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
////////////////////////////////////////////////////////////////////////////
Modified: trunk/boost/unordered/detail/buckets.hpp
==============================================================================
--- trunk/boost/unordered/detail/buckets.hpp (original)
+++ trunk/boost/unordered/detail/buckets.hpp 2012-08-25 17:53:25 EDT (Sat, 25 Aug 2012)
@@ -112,7 +112,8 @@
{
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 @@
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 @@
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);
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk