From 6ccc68b15c87051aa276087079d8a4bc0991c951 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Thu, 26 Mar 2009 21:09:51 +0000 Subject: [PATCH] Give up and use another macro to destruct values. [SVN r51995] --- include/boost/unordered/detail/hash_table.hpp | 10 ++++++++++ include/boost/unordered/detail/hash_table_impl.hpp | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/include/boost/unordered/detail/hash_table.hpp b/include/boost/unordered/detail/hash_table.hpp index 9d5e78e6..c6ded509 100644 --- a/include/boost/unordered/detail/hash_table.hpp +++ b/include/boost/unordered/detail/hash_table.hpp @@ -223,6 +223,16 @@ namespace boost { 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 + void destroy(T* x) { + x->~T(); + } +#endif } } diff --git a/include/boost/unordered/detail/hash_table_impl.hpp b/include/boost/unordered/detail/hash_table_impl.hpp index 145ef965..a8e86ad4 100644 --- a/include/boost/unordered/detail/hash_table_impl.hpp +++ b/include/boost/unordered/detail/hash_table_impl.hpp @@ -130,7 +130,7 @@ namespace boost { void destroy(link_ptr ptr) { node* raw_ptr = static_cast(&*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 @@ namespace boost { { if (node_) { if (value_constructed_) { - (&node_->value())->~value_type(); + BOOST_UNORDERED_DESTRUCT(&node_->value(), value_type); } if (node_constructed_)