From c101aec06c2a7f96f587257095fb5caaf7c4bf8c Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sun, 4 Sep 2011 19:49:11 +0000 Subject: [PATCH] Unordered: Use `destroy` workaround for `allocator_traits`. [SVN r74235] --- .../unordered/detail/allocator_helpers.hpp | 18 +++++++++++++++++- include/boost/unordered/detail/util.hpp | 16 ---------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/include/boost/unordered/detail/allocator_helpers.hpp b/include/boost/unordered/detail/allocator_helpers.hpp index d299f5d9..4cd6cfc8 100644 --- a/include/boost/unordered/detail/allocator_helpers.hpp +++ b/include/boost/unordered/detail/allocator_helpers.hpp @@ -56,6 +56,22 @@ namespace boost { namespace unordered { namespace detail { namespace boost { namespace unordered { namespace detail { + // Explicitly call a destructor + +#if defined(BOOST_MSVC) +#pragma warning(push) +#pragma warning(disable:4100) // unreferenced formal parameter +#endif + + template + inline void destroy(T* x) { + x->~T(); + } + +#if defined(BOOST_MSVC) +#pragma warning(pop) +#endif + #if BOOST_UNORDERED_USE_ALLOCATOR_TRAITS template struct allocator_traits : std::allocator_traits {}; @@ -364,7 +380,7 @@ namespace boost { namespace unordered { namespace detail { static void destroy(Alloc&, T* p, typename boost::disable_if, void*>::type = 0) { - p->~T(); + ::boost::unordered::detail::destroy(p); } static size_type max_size(const Alloc& a) diff --git a/include/boost/unordered/detail/util.hpp b/include/boost/unordered/detail/util.hpp index 22b5b539..fa0dd552 100644 --- a/include/boost/unordered/detail/util.hpp +++ b/include/boost/unordered/detail/util.hpp @@ -117,22 +117,6 @@ namespace boost { namespace unordered { namespace detail { struct map_extractor; struct no_key; - // Explicitly call a destructor - -#if defined(BOOST_MSVC) -#pragma warning(push) -#pragma warning(disable:4100) // unreferenced formal parameter -#endif - - template - inline void destroy(T* x) { - x->~T(); - } - -#if defined(BOOST_MSVC) -#pragma warning(pop) -#endif - #if !defined(BOOST_NO_RVALUE_REFERENCES) #define BOOST_UNORDERED_RV_REF(T) BOOST_RV_REF(T)