]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
2008-10-20 Paolo Carlini <paolo.carlini@oracle.com>
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 20 Oct 2008 16:43:28 +0000 (16:43 +0000)
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 20 Oct 2008 16:43:28 +0000 (16:43 +0000)
* include/tr1_impl/hashtable_policy.h (_Hash_node<>::_Hash_node<>
(_Args&&...)): Add in C++0x mode.
* include/tr1_impl/hashtable (_Hashtable<>::_M_allocate_node,
_Hashtable<>::_M_deallocate_node): Use _M_get_Node_allocator in
C++0x mode.

* include/tr1_impl/hashtable (_Hashtable<>::max_size): Use
Node_allocator for improved accuracy.
* testsuite/tr1/6_containers/unordered_multimap/capacity/
29134-multimap.cc: Adjust.
* testsuite/tr1/6_containers/unordered_multimap/capacity/
29134-map.cc: Likewise.
* testsuite/tr1/6_containers/unordered_multimap/capacity/
29134-multiset.cc: Adjust.
* testsuite/tr1/6_containers/unordered_multimap/capacity/
29134-set.cc: Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@141242 138bc75d-0d04-0410-961f-82ee72b054a4

libstdc++-v3/ChangeLog
libstdc++-v3/include/tr1_impl/hashtable
libstdc++-v3/include/tr1_impl/hashtable_policy.h
libstdc++-v3/testsuite/tr1/6_containers/unordered_map/capacity/29134-map.cc
libstdc++-v3/testsuite/tr1/6_containers/unordered_multimap/capacity/29134-multimap.cc
libstdc++-v3/testsuite/tr1/6_containers/unordered_multiset/capacity/29134-multiset.cc
libstdc++-v3/testsuite/tr1/6_containers/unordered_set/capacity/29134-set.cc

index 10f226d04bcf6a3f3bcc3f5cee0660496562a021..4531127d7ec7a51f0ca6a4d4f8939d53995c2619 100644 (file)
@@ -1,3 +1,22 @@
+2008-10-20  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       * include/tr1_impl/hashtable_policy.h (_Hash_node<>::_Hash_node<>
+       (_Args&&...)): Add in C++0x mode.
+       * include/tr1_impl/hashtable (_Hashtable<>::_M_allocate_node,
+       _Hashtable<>::_M_deallocate_node): Use _M_get_Node_allocator in
+       C++0x mode.
+
+       * include/tr1_impl/hashtable (_Hashtable<>::max_size): Use
+       Node_allocator for improved accuracy.
+       * testsuite/tr1/6_containers/unordered_multimap/capacity/
+       29134-multimap.cc: Adjust.
+       * testsuite/tr1/6_containers/unordered_multimap/capacity/
+       29134-map.cc: Likewise.
+       * testsuite/tr1/6_containers/unordered_multimap/capacity/
+       29134-multiset.cc: Adjust.
+       * testsuite/tr1/6_containers/unordered_multimap/capacity/
+       29134-set.cc: Likewise.
+
 2008-10-19  Paolo Carlini  <paolo.carlini@oracle.com>
 
        * include/bits/stl_tree.h (_Rb_tree_node<>::_Rb_tree_node<>
index c76deb06ca7dfa6a0c655d4852c597b14a0d99e0..c6f1ac7aff6df1b124d261ee71f54e4d1ed65835 100644 (file)
@@ -296,7 +296,7 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
 
       size_type
       max_size() const
-      { return _M_get_Value_allocator().max_size(); }
+      { return _M_node_allocator.max_size(); }
 
       // Observers
       key_equal
@@ -484,7 +484,11 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
       _Node* __n = _M_node_allocator.allocate(1);
       try
        {
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+         _M_node_allocator.construct(__n, __v);
+#else
          _M_get_Value_allocator().construct(&__n->_M_v, __v);
+#endif
          __n->_M_next = 0;
          return __n;
        }
@@ -504,7 +508,11 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
               _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
     _M_deallocate_node(_Node* __n)
     {
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+      _M_node_allocator.destroy(__n);
+#else
       _M_get_Value_allocator().destroy(&__n->_M_v);
+#endif
       _M_node_allocator.deallocate(__n, 1);
     }
 
index 6677a72d8d2eb3726efdd91d2bc0fa8a1f798e86..1468ee8e989e5851e2f8731ae5dbd28cfa67f9d5 100644 (file)
@@ -99,6 +99,13 @@ namespace __detail
       _Value       _M_v;
       std::size_t  _M_hash_code;
       _Hash_node*  _M_next;
+
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+      template<typename... _Args>
+        _Hash_node(_Args&&... __args)
+         : _M_v(std::forward<_Args>(__args)...),
+           _M_hash_code(), _M_next() { }
+#endif
     };
 
   template<typename _Value>
@@ -106,6 +113,13 @@ namespace __detail
     {
       _Value       _M_v;
       _Hash_node*  _M_next;
+
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+      template<typename... _Args>
+        _Hash_node(_Args&&... __args)
+         : _M_v(std::forward<_Args>(__args)...),
+           _M_next() { }
+#endif
     };
 
   // Local iterators, used to iterate within a bucket but not between
index 459ace41a888e3259ca823f3a078ef02fed5c5e2..24d51ef508e74f658f2c871739b0b2b6673f5666 100644 (file)
@@ -1,4 +1,4 @@
-// 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
 // software; you can redistribute it and/or modify it under the
@@ -28,7 +28,8 @@ void test01()
 
   std::tr1::unordered_map<int, int> um;
 
-  VERIFY( um.max_size() == um.get_allocator().max_size() );
+  VERIFY( (um.max_size() == std::allocator<std::tr1::__detail::_Hash_node<
+          std::pair<const int, int>, false> >().max_size()));
 }
 
 int main()
index af41fa154d6c158d60845314910eaa07995d4063..dc1db5088115da18c33d3dfe8527e6c45d2b2622 100644 (file)
@@ -1,4 +1,4 @@
-// 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
 // software; you can redistribute it and/or modify it under the
@@ -28,7 +28,8 @@ void test01()
 
   std::tr1::unordered_multimap<int, int> umm;
 
-  VERIFY( umm.max_size() == umm.get_allocator().max_size() );
+  VERIFY( (umm.max_size() == std::allocator<std::tr1::__detail::_Hash_node<
+          std::pair<const int, int>, false> >().max_size()) );
 }
 
 int main()
index 923af9be118e71af4c2e78eb447a62954a603ce0..f4e2f6a1c2507633d7ccc8f699cfe9bd8e7f87fe 100644 (file)
@@ -1,4 +1,4 @@
-// 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
 // software; you can redistribute it and/or modify it under the
@@ -28,7 +28,8 @@ void test01()
 
   std::tr1::unordered_multiset<int> ums;
 
-  VERIFY( ums.max_size() == ums.get_allocator().max_size() );
+  VERIFY( (ums.max_size() == std::allocator<std::tr1::__detail::_Hash_node<
+          int, false> >().max_size()) );
 }
 
 int main()
index 5822341c85e0547162134c8b9f17adc4451e9379..ca8333e42f6acfa7ea4e194a1cc767bd60cbf4dd 100644 (file)
@@ -1,4 +1,4 @@
-// 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
 // software; you can redistribute it and/or modify it under the
@@ -28,7 +28,8 @@ void test01()
 
   std::tr1::unordered_set<int> us;
 
-  VERIFY( us.max_size() == us.get_allocator().max_size() );
+  VERIFY( (us.max_size() == std::allocator<std::tr1::__detail::_Hash_node<
+          int, false> >().max_size()) );
 }
 
 int main()