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

* include/bits/stl_tree.h (_Rb_tree_node<>::_Rb_tree_node<>
	(_Args&&...)): Add in C++0x mode.
	(_Rb_tree<>::_M_create_node<>(_Args&&...)): Add in C++0x mode,
	use _M_get_Node_allocator.
	(_Rb_tree<>::_M_destroy_node(_Link_type): Use _M_get_Node_allocator
	in C++0x mode.
	* testsuite/23_containers/set/operators/1_neg.cc: Adjust dg-error
	line numbers.
	* testsuite/23_containers/map/operators/1_neg.cc: Likewise.

From-SVN: r141226
This commit is contained in:
Paolo Carlini 2008-10-19 14:49:38 +00:00 committed by Paolo Carlini
parent a7e72022ce
commit 25bbe9bc63
4 changed files with 59 additions and 13 deletions

View File

@ -1,3 +1,15 @@
2008-10-19 Paolo Carlini <paolo.carlini@oracle.com>
* include/bits/stl_tree.h (_Rb_tree_node<>::_Rb_tree_node<>
(_Args&&...)): Add in C++0x mode.
(_Rb_tree<>::_M_create_node<>(_Args&&...)): Add in C++0x mode,
use _M_get_Node_allocator.
(_Rb_tree<>::_M_destroy_node(_Link_type): Use _M_get_Node_allocator
in C++0x mode.
* testsuite/23_containers/set/operators/1_neg.cc: Adjust dg-error
line numbers.
* testsuite/23_containers/map/operators/1_neg.cc: Likewise.
2008-10-18 Douglas Gregor <doug.gregor@gmail.com>
* include/bits/stl_pair.h (__may_be_null_pointer_init): New.

View File

@ -133,6 +133,13 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
{
typedef _Rb_tree_node<_Val>* _Link_type;
_Val _M_value_field;
#ifdef __GXX_EXPERIMENTAL_CXX0X__
template<typename... _Args>
_Rb_tree_node(_Args&&... __args)
: _Rb_tree_node_base(),
_M_value_field(std::forward<_Args>(__args)...) { }
#endif
};
_Rb_tree_node_base*
@ -360,6 +367,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_M_put_node(_Link_type __p)
{ _M_impl._Node_allocator::deallocate(__p, 1); }
#ifndef __GXX_EXPERIMENTAL_CXX0X__
_Link_type
_M_create_node(const value_type& __x)
{
@ -374,6 +382,39 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
return __tmp;
}
void
_M_destroy_node(_Link_type __p)
{
get_allocator().destroy(&__p->_M_value_field);
_M_put_node(__p);
}
#else
template<typename... _Args>
_Link_type
_M_create_node(_Args&&... __args)
{
_Link_type __tmp = _M_get_node();
try
{
_M_get_Node_allocator().construct(__tmp,
std::forward<_Args>(__args)...);
}
catch(...)
{
_M_put_node(__tmp);
__throw_exception_again;
}
return __tmp;
}
void
_M_destroy_node(_Link_type __p)
{
_M_get_Node_allocator().destroy(__p);
_M_put_node(__p);
}
#endif
_Link_type
_M_clone_node(_Const_Link_type __x)
{
@ -384,13 +425,6 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
return __tmp;
}
void
_M_destroy_node(_Link_type __p)
{
get_allocator().destroy(&__p->_M_value_field);
_M_put_node(__p);
}
protected:
template<typename _Key_compare,
bool _Is_pod_comparator = __is_pod(_Key_compare)>

View File

@ -1,6 +1,6 @@
// { dg-do compile }
// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@ -42,5 +42,5 @@ void test01()
test &= itr == mapByName.end(); // { dg-error "no" }
}
// { dg-error "candidates are" "" { target *-*-* } 210 }
// { dg-error "candidates are" "" { target *-*-* } 214 }
// { dg-error "candidates are" "" { target *-*-* } 217 }
// { dg-error "candidates are" "" { target *-*-* } 221 }

View File

@ -1,6 +1,6 @@
// { dg-do compile }
// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@ -40,5 +40,5 @@ void test01()
test &= itr == setByName.end(); // { dg-error "no" }
}
// { dg-error "candidates are" "" { target *-*-* } 285 }
// { dg-error "candidates are" "" { target *-*-* } 289 }
// { dg-error "candidates are" "" { target *-*-* } 292 }
// { dg-error "candidates are" "" { target *-*-* } 296 }