Commit c841843f by Paolo Carlini Committed by Paolo Carlini

stl_list.h (_List_node<>::_List_node<>(_Args&&...)): Add in C++0x mode.

2008-10-14  Paolo Carlini  <paolo.carlini@oracle.com>

	* include/bits/stl_list.h (_List_node<>::_List_node<>(_Args&&...)):
	Add in C++0x mode.
	(list<>::_M_create_node<>(_Args&&...)): Use _M_get_Node_allocator.
	(list<>::_M_erase(iterator): Likewise, in C++0x mode.
	* include/bits/list.tcc (_List_base<>::_M_clear): Likewise.
	* testsuite/23_containers/list/requirements/dr438/assign_neg.cc:
	Adjust dg-error line number.
	* testsuite/23_containers/list/requirements/dr438/insert_neg.cc:
	Likewise.
	* testsuite/23_containers/list/requirements/dr438/
	constructor_1_neg.cc: Likewise.
	* testsuite/23_containers/list/requirements/dr438/
	constructor_2_neg.cc: Likewise.

From-SVN: r141113
parent 9c880618
2008-10-14 Paolo Carlini <paolo.carlini@oracle.com> 2008-10-14 Paolo Carlini <paolo.carlini@oracle.com>
* include/bits/stl_list.h (_List_node<>::_List_node<>(_Args&&...)):
Add in C++0x mode.
(list<>::_M_create_node<>(_Args&&...)): Use _M_get_Node_allocator.
(list<>::_M_erase(iterator): Likewise, in C++0x mode.
* include/bits/list.tcc (_List_base<>::_M_clear): Likewise.
* testsuite/23_containers/list/requirements/dr438/assign_neg.cc:
Adjust dg-error line number.
* testsuite/23_containers/list/requirements/dr438/insert_neg.cc:
Likewise.
* testsuite/23_containers/list/requirements/dr438/
constructor_1_neg.cc: Likewise.
* testsuite/23_containers/list/requirements/dr438/
constructor_2_neg.cc: Likewise.
2008-10-14 Paolo Carlini <paolo.carlini@oracle.com>
* include/bits/stl_tree.h (_Rb_tree<>::max_size): Use Node_allocator * include/bits/stl_tree.h (_Rb_tree<>::max_size): Use Node_allocator
for improved accuracy. for improved accuracy.
* include/bits/stl_list.h (list<>::max_size): Likewise. * include/bits/stl_list.h (list<>::max_size): Likewise.
......
// List implementation (out of line) -*- C++ -*- // List implementation (out of line) -*- C++ -*-
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 // Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
// Free Software Foundation, Inc. // Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
...@@ -75,7 +75,11 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) ...@@ -75,7 +75,11 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
{ {
_Node* __tmp = __cur; _Node* __tmp = __cur;
__cur = static_cast<_Node*>(__cur->_M_next); __cur = static_cast<_Node*>(__cur->_M_next);
#ifdef __GXX_EXPERIMENTAL_CXX0X__
_M_get_Node_allocator().destroy(__tmp);
#else
_M_get_Tp_allocator().destroy(&__tmp->_M_data); _M_get_Tp_allocator().destroy(&__tmp->_M_data);
#endif
_M_put_node(__tmp); _M_put_node(__tmp);
} }
} }
......
...@@ -101,6 +101,12 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) ...@@ -101,6 +101,12 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
{ {
///< User's data. ///< User's data.
_Tp _M_data; _Tp _M_data;
#ifdef __GXX_EXPERIMENTAL_CXX0X__
template<typename... _Args>
_List_node(_Args&&... __args)
: _List_node_base(), _M_data(std::forward<_Args>(__args)...) { }
#endif
}; };
/** /**
...@@ -478,8 +484,8 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) ...@@ -478,8 +484,8 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
_Node* __p = this->_M_get_node(); _Node* __p = this->_M_get_node();
try try
{ {
_M_get_Tp_allocator().construct(&__p->_M_data, _M_get_Node_allocator().construct(__p,
std::forward<_Args>(__args)...); std::forward<_Args>(__args)...);
} }
catch(...) catch(...)
{ {
...@@ -1423,7 +1429,11 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) ...@@ -1423,7 +1429,11 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
{ {
__position._M_node->unhook(); __position._M_node->unhook();
_Node* __n = static_cast<_Node*>(__position._M_node); _Node* __n = static_cast<_Node*>(__position._M_node);
_M_get_Tp_allocator().destroy(&__n->_M_data); #ifdef __GXX_EXPERIMENTAL_CXX0X__
_M_get_Node_allocator().destroy(__n);
#else
_M_get_Tp_allocator().destroy(&__n->_M_data);
#endif
_M_put_node(__n); _M_put_node(__n);
} }
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
// USA. // USA.
// { dg-do compile } // { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 1383 } // { dg-error "no matching" "" { target *-*-* } 1389 }
// { dg-excess-errors "" } // { dg-excess-errors "" }
#include <list> #include <list>
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
// USA. // USA.
// { dg-do compile } // { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 1352 } // { dg-error "no matching" "" { target *-*-* } 1358 }
// { dg-excess-errors "" } // { dg-excess-errors "" }
#include <list> #include <list>
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
// USA. // USA.
// { dg-do compile } // { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 1352 } // { dg-error "no matching" "" { target *-*-* } 1358 }
// { dg-excess-errors "" } // { dg-excess-errors "" }
#include <list> #include <list>
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
// USA. // USA.
// { dg-do compile } // { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 1352 } // { dg-error "no matching" "" { target *-*-* } 1358 }
// { dg-excess-errors "" } // { dg-excess-errors "" }
#include <list> #include <list>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment