Give up and use another macro to destruct values.

[SVN r51995]
This commit is contained in:
Daniel James
2009-03-26 21:09:51 +00:00
parent 188bcafdec
commit 6ccc68b15c
2 changed files with 12 additions and 2 deletions

View File

@@ -223,6 +223,16 @@ namespace boost {
functions func2_; functions func2_;
functions_ptr func_; // The currently active functions. 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
} }
} }

View File

@@ -130,7 +130,7 @@ namespace boost {
void destroy(link_ptr ptr) void destroy(link_ptr ptr)
{ {
node* raw_ptr = static_cast<node*>(&*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_ptr n(node_alloc_.address(*raw_ptr));
node_alloc_.destroy(n); node_alloc_.destroy(n);
node_alloc_.deallocate(n, 1); node_alloc_.deallocate(n, 1);
@@ -172,7 +172,7 @@ namespace boost {
{ {
if (node_) { if (node_) {
if (value_constructed_) { if (value_constructed_) {
(&node_->value())->~value_type(); BOOST_UNORDERED_DESTRUCT(&node_->value(), value_type);
} }
if (node_constructed_) if (node_constructed_)