From 61a2f49ef28f7ae22c8fab412ab967638fed38fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Fri, 12 Jun 2015 23:51:58 +0200 Subject: [PATCH] Fixes Trac #11388 (boost::container::list::emplace_back broken on Visual Studio 2010) --- doc/container.qbk | 4 +- .../container/detail/node_alloc_holder.hpp | 98 ++++--------------- 2 files changed, 20 insertions(+), 82 deletions(-) diff --git a/doc/container.qbk b/doc/container.qbk index 2a7ce94..476ca7c 100644 --- a/doc/container.qbk +++ b/doc/container.qbk @@ -1099,12 +1099,12 @@ use [*Boost.Container]? There are several reasons for that: [section:release_notes_boost_1_59_00 Boost 1.59 Release] * [@https://github.com/boostorg/container/pull/26 GitHub #26: ['Fix bug in stable_vector::capacity()]]. Thanks to timsong-cpp/Arindam Mukerjee. -* [@https://github.com/boostorg/container/pull/26 GitHub #27: ['fix stable_vector's index_of's doxygen comment]]. Thanks to kariya-mitsuru. +* [@https://github.com/boostorg/container/pull/27 GitHub #27: ['fix stable_vector's index_of's doxygen comment]]. Thanks to kariya-mitsuru. * [@https://svn.boost.org/trac/boost/ticket/11380 Trac #11380: ['"Container library std forward declarations incorrect in std_fwd.hpp on libc++ with gcc"]]. +* [@https://svn.boost.org/trac/boost/ticket/11388 Trac #11388: ['"boost::container::list::emplace_back broken on Visual Studio 2010"]]. [endsect] -https://github.com/boostorg/container/pull/26 [section:release_notes_boost_1_58_00 Boost 1.58 Release] * Experimental [classref boost::container::small_vector small_vector] container. * Massive dependency reorganization. Now [*Boost.Container] depends on very basic utilities like Boost.Core diff --git a/include/boost/container/detail/node_alloc_holder.hpp b/include/boost/container/detail/node_alloc_holder.hpp index 0d4e273..3b632a6 100644 --- a/include/boost/container/detail/node_alloc_holder.hpp +++ b/include/boost/container/detail/node_alloc_holder.hpp @@ -173,87 +173,25 @@ struct node_alloc_holder } #else //defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - NodePtr create_node() - { - NodePtr p = this->allocate_one(); - Deallocator node_deallocator(p, this->node_alloc()); - allocator_traits::construct - (this->node_alloc(), container_detail::addressof(p->m_data)); - node_deallocator.release(); - typedef typename Node::hook_type hook_type; - ::new(static_cast(container_detail::to_raw_pointer(p)), boost_container_new_t()) hook_type; - return (p); - } - template - NodePtr create_node(BOOST_MOVE_UREF1) - { - NodePtr p = this->allocate_one(); - Deallocator node_deallocator(p, this->node_alloc()); - allocator_traits::construct - (this->node_alloc(), container_detail::addressof(p->m_data) - , BOOST_MOVE_FWD1); - node_deallocator.release(); - typedef typename Node::hook_type hook_type; - ::new(static_cast(container_detail::to_raw_pointer(p)), boost_container_new_t()) hook_type; - return (p); - } - - template - NodePtr create_node(BOOST_MOVE_UREF2) - { - NodePtr p = this->allocate_one(); - Deallocator node_deallocator(p, this->node_alloc()); - allocator_traits::construct - (this->node_alloc(), container_detail::addressof(p->m_data) - , BOOST_MOVE_FWD2); - node_deallocator.release(); - typedef typename Node::hook_type hook_type; - ::new(static_cast(container_detail::to_raw_pointer(p)), boost_container_new_t()) hook_type; - return (p); - } - - template - NodePtr create_node(BOOST_MOVE_UREF3) - { - NodePtr p = this->allocate_one(); - Deallocator node_deallocator(p, this->node_alloc()); - allocator_traits::construct - (this->node_alloc(), container_detail::addressof(p->m_data) - , BOOST_MOVE_FWD3); - node_deallocator.release(); - typedef typename Node::hook_type hook_type; - ::new(static_cast(container_detail::to_raw_pointer(p)), boost_container_new_t()) hook_type; - return (p); - } - - template - NodePtr create_node(BOOST_MOVE_UREF4) - { - NodePtr p = this->allocate_one(); - Deallocator node_deallocator(p, this->node_alloc()); - allocator_traits::construct - (this->node_alloc(), container_detail::addressof(p->m_data) - , BOOST_MOVE_FWD4); - node_deallocator.release(); - typedef typename Node::hook_type hook_type; - ::new(static_cast(container_detail::to_raw_pointer(p)), boost_container_new_t()) hook_type; - return (p); - } - - template - NodePtr create_node(BOOST_MOVE_UREF5) - { - NodePtr p = this->allocate_one(); - Deallocator node_deallocator(p, this->node_alloc()); - allocator_traits::construct - (this->node_alloc(), container_detail::addressof(p->m_data) - , BOOST_MOVE_FWD5); - node_deallocator.release(); - typedef typename Node::hook_type hook_type; - ::new(static_cast(container_detail::to_raw_pointer(p)), boost_container_new_t()) hook_type; - return (p); - } + #define BOOST_CONTAINER_NODE_ALLOC_HOLDER_CONSTRUCT_IMPL(N) \ + BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ + NodePtr create_node(BOOST_MOVE_UREF##N)\ + {\ + NodePtr p = this->allocate_one();\ + Deallocator node_deallocator(p, this->node_alloc());\ + allocator_traits::construct\ + ( this->node_alloc()\ + , container_detail::addressof(p->m_data)\ + BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\ + node_deallocator.release();\ + typedef typename Node::hook_type hook_type;\ + ::new(static_cast(container_detail::to_raw_pointer(p)), boost_container_new_t()) hook_type;\ + return (p);\ + }\ + // + BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_NODE_ALLOC_HOLDER_CONSTRUCT_IMPL) + #undef BOOST_CONTAINER_NODE_ALLOC_HOLDER_CONSTRUCT_IMPL #endif // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)