]> gcc.gnu.org Git - gcc.git/commitdiff
unordered_map (unordered_map<>::operator[](_Key&&)): Add.
authorPaolo Carlini <paolo.carlini@oracle.com>
Sun, 7 Nov 2010 18:56:56 +0000 (18:56 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Sun, 7 Nov 2010 18:56:56 +0000 (18:56 +0000)
2010-11-07  Paolo Carlini  <paolo.carlini@oracle.com>

* include/profile/unordered_map (unordered_map<>::operator[](_Key&&)):
Add.

From-SVN: r166420

libstdc++-v3/ChangeLog
libstdc++-v3/include/profile/unordered_map

index 1bc5dfab23b41d3a3e52840ea3d481ca5c0bb319..d9156b1b3806473d28b20176a3a81de661f0290a 100644 (file)
@@ -1,3 +1,8 @@
+2010-11-07  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       * include/profile/unordered_map (unordered_map<>::operator[](_Key&&)):
+       Add.
+
 2010-11-07  Paolo Carlini  <paolo.carlini@oracle.com>
 
        * include/profile/bitset (bitset<>::bitset(), bitset<>::
index 18563d8750822651d8b1964e118080451327387b..49345cc53aef76b91def1009271d623dcbea40be 100644 (file)
@@ -232,17 +232,27 @@ namespace __profile
         _Base::insert(__first, __last);
         _M_profile_resize(__old_size, _Base::bucket_count()); 
       }
-     
-      // operator []
+
+      // operator[]
+      mapped_type&
+      operator[](const _Key& __k)
+      {
+        size_type __old_size =  _Base::bucket_count();
+        mapped_type& __res = _M_base()[__k];
+        size_type __new_size =  _Base::bucket_count();
+        _M_profile_resize(__old_size, _Base::bucket_count()); 
+        return __res;
+      }
+
       mapped_type&
-      operator[](const _Key& _k)
+      operator[](_Key&& __k)
       {
         size_type __old_size =  _Base::bucket_count();
-        mapped_type& __res = _M_base()[_k];
+        mapped_type& __res = _M_base()[std::move(__k)];
         size_type __new_size =  _Base::bucket_count();
         _M_profile_resize(__old_size, _Base::bucket_count()); 
         return __res;
-      }   
+      }
 
       void
       swap(unordered_map& __x)
This page took 0.067742 seconds and 5 git commands to generate.