Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r51995 - trunk/boost/unordered/detail
From: daniel_james_at_[hidden]
Date: 2009-03-26 17:09:52


Author: danieljames
Date: 2009-03-26 17:09:51 EDT (Thu, 26 Mar 2009)
New Revision: 51995
URL: http://svn.boost.org/trac/boost/changeset/51995

Log:
Give up and use another macro to destruct values.
Text files modified:
   trunk/boost/unordered/detail/hash_table.hpp | 10 ++++++++++
   trunk/boost/unordered/detail/hash_table_impl.hpp | 4 ++--
   2 files changed, 12 insertions(+), 2 deletions(-)

Modified: trunk/boost/unordered/detail/hash_table.hpp
==============================================================================
--- trunk/boost/unordered/detail/hash_table.hpp (original)
+++ trunk/boost/unordered/detail/hash_table.hpp 2009-03-26 17:09:51 EDT (Thu, 26 Mar 2009)
@@ -223,6 +223,16 @@
             functions func2_;
             functions_ptr func_; // The currently active functions.
         };
+
+#if defined(BOOST_MSVC)
+# define BOOST_UNORDERED_DESTRUCT(x, type) (x)->~type();
+#else
+# define BOOST_UNORDERED_DESTRUCT(x, type) boost::unordered_detail::destroy(x)
+ template <typename T>
+ void destroy(T* x) {
+ x->~T();
+ }
+#endif
     }
 }
 

Modified: trunk/boost/unordered/detail/hash_table_impl.hpp
==============================================================================
--- trunk/boost/unordered/detail/hash_table_impl.hpp (original)
+++ trunk/boost/unordered/detail/hash_table_impl.hpp 2009-03-26 17:09:51 EDT (Thu, 26 Mar 2009)
@@ -130,7 +130,7 @@
                 void destroy(link_ptr ptr)
                 {
                     node* raw_ptr = static_cast<node*>(&*ptr);
- (&raw_ptr->value())->~value_type();
+ BOOST_UNORDERED_DESTRUCT(&raw_ptr->value(), value_type);
                     node_ptr n(node_alloc_.address(*raw_ptr));
                     node_alloc_.destroy(n);
                     node_alloc_.deallocate(n, 1);
@@ -172,7 +172,7 @@
                 {
                     if (node_) {
                         if (value_constructed_) {
- (&node_->value())->~value_type();
+ BOOST_UNORDERED_DESTRUCT(&node_->value(), value_type);
                         }
 
                         if (node_constructed_)


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