[patch] Simplify allocator use

Jonathan Wakely jwakely@redhat.com
Thu Jun 26 11:35:00 GMT 2014


On 26/06/14 12:31 +0100, Jonathan Wakely wrote:
>@@ -137,20 +139,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> 	      __node_type* __node = _M_nodes;
> 	      _M_nodes = _M_nodes->_M_next();
> 	      __node->_M_nxt = nullptr;
>-	      __value_alloc_type __a(_M_h._M_node_allocator());
>-	      __value_alloc_traits::destroy(__a, __node->_M_valptr());
>-	      __try
>-		{
>-		  __value_alloc_traits::construct(__a, __node->_M_valptr(),
>-						  std::forward<_Arg>(__arg));
>-		}
>-	      __catch(...)
>-		{
>-		  __node->~__node_type();
>-		  __node_alloc_traits::deallocate(_M_h._M_node_allocator(),
>-						  __node, 1);

I forgot to mention the change also fixes a bug in the line above:
__node should be converted to the allocator's pointer type before
passing it to deallocate. Using __allocated_ptr takes care of that.



More information about the Libstdc++ mailing list