Commit 1fea874e by Paolo Carlini Committed by Paolo Carlini

stl_tree.h (_Rb_tree<>::max_size): Use Node_allocator for improved accuracy.

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

	* include/bits/stl_tree.h (_Rb_tree<>::max_size): Use Node_allocator
	for improved accuracy.
	* include/bits/stl_list.h (list<>::max_size): Likewise.
	* testsuite/23_containers/multimap/capacity/29134.cc: Adjust.
	* testsuite/23_containers/set/capacity/29134.cc: Likewise.
	* testsuite/23_containers/multiset/capacity/29134.cc: Likewise.
	* testsuite/23_containers/list/capacity/29134.cc: Likewise.
	* testsuite/23_containers/map/capacity/29134.cc: Likewise.

From-SVN: r141110
parent 388092d5
2008-10-14 Paolo Carlini <paolo.carlini@oracle.com>
* include/bits/stl_tree.h (_Rb_tree<>::max_size): Use Node_allocator
for improved accuracy.
* include/bits/stl_list.h (list<>::max_size): Likewise.
* testsuite/23_containers/multimap/capacity/29134.cc: Adjust.
* testsuite/23_containers/set/capacity/29134.cc: Likewise.
* testsuite/23_containers/multiset/capacity/29134.cc: Likewise.
* testsuite/23_containers/list/capacity/29134.cc: Likewise.
* testsuite/23_containers/map/capacity/29134.cc: Likewise.
2008-10-10 Paolo Carlini <paolo.carlini@oracle.com> 2008-10-10 Paolo Carlini <paolo.carlini@oracle.com>
* testsuite/20_util/reference_wrapper/24803.cc: Avoid uninitialized * testsuite/20_util/reference_wrapper/24803.cc: Avoid uninitialized
......
...@@ -807,7 +807,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) ...@@ -807,7 +807,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
/** Returns the size() of the largest possible %list. */ /** Returns the size() of the largest possible %list. */
size_type size_type
max_size() const max_size() const
{ return _M_get_Tp_allocator().max_size(); } { return _M_get_Node_allocator().max_size(); }
/** /**
* @brief Resizes the %list to the specified number of elements. * @brief Resizes the %list to the specified number of elements.
......
// RB tree implementation -*- C++ -*- // RB tree implementation -*- 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
...@@ -643,7 +643,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -643,7 +643,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
size_type size_type
max_size() const max_size() const
{ return get_allocator().max_size(); } { return _M_get_Node_allocator().max_size(); }
void void
#ifdef __GXX_EXPERIMENTAL_CXX0X__ #ifdef __GXX_EXPERIMENTAL_CXX0X__
......
// Copyright (C) 2006 Free Software Foundation, Inc. // Copyright (C) 2006, 2007, 2008 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
// software; you can redistribute it and/or modify it under the // software; you can redistribute it and/or modify it under the
...@@ -28,7 +28,13 @@ void test01() ...@@ -28,7 +28,13 @@ void test01()
std::list<int> l; std::list<int> l;
VERIFY( l.max_size() == l.get_allocator().max_size() ); #ifndef _GLIBCXX_DEBUG
using std::_List_node;
#else
using std::_GLIBCXX_STD_D::_List_node;
#endif
VERIFY( l.max_size() == std::allocator<_List_node<int> >().max_size() );
} }
int main() int main()
......
// Copyright (C) 2006 Free Software Foundation, Inc. // Copyright (C) 2006, 2007, 2008 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
// software; you can redistribute it and/or modify it under the // software; you can redistribute it and/or modify it under the
...@@ -28,7 +28,8 @@ void test01() ...@@ -28,7 +28,8 @@ void test01()
std::map<int, int> m; std::map<int, int> m;
VERIFY( m.max_size() == m.get_allocator().max_size() ); VERIFY( (m.max_size() == std::allocator<std::_Rb_tree_node<
std::pair<const int, int> > >().max_size()) );
} }
int main() int main()
......
// Copyright (C) 2006 Free Software Foundation, Inc. // Copyright (C) 2006, 2007, 2008 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
// software; you can redistribute it and/or modify it under the // software; you can redistribute it and/or modify it under the
...@@ -28,7 +28,8 @@ void test01() ...@@ -28,7 +28,8 @@ void test01()
std::multimap<int, int> mm; std::multimap<int, int> mm;
VERIFY( mm.max_size() == mm.get_allocator().max_size() ); VERIFY( (mm.max_size() == std::allocator<std::_Rb_tree_node<
std::pair<const int, int> > >().max_size()) );
} }
int main() int main()
......
// Copyright (C) 2006 Free Software Foundation, Inc. // Copyright (C) 2006, 2007, 2008 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
// software; you can redistribute it and/or modify it under the // software; you can redistribute it and/or modify it under the
...@@ -28,7 +28,8 @@ void test01() ...@@ -28,7 +28,8 @@ void test01()
std::multiset<int> ms; std::multiset<int> ms;
VERIFY( ms.max_size() == ms.get_allocator().max_size() ); VERIFY( ms.max_size()
== std::allocator<std::_Rb_tree_node<int> >().max_size() );
} }
int main() int main()
......
// Copyright (C) 2006 Free Software Foundation, Inc. // Copyright (C) 2006, 2007, 2008 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
// software; you can redistribute it and/or modify it under the // software; you can redistribute it and/or modify it under the
...@@ -28,7 +28,8 @@ void test01() ...@@ -28,7 +28,8 @@ void test01()
std::set<int> s; std::set<int> s;
VERIFY( s.max_size() == s.get_allocator().max_size() ); VERIFY( s.max_size() ==
std::allocator<std::_Rb_tree_node<int> >().max_size() );
} }
int main() int main()
......
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