aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2010-11-07 18:56:56 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2010-11-07 18:56:56 +0000
commitbe3c93b01193a0811d38678c123ea3345af73e98 (patch)
treeafd01c1e07e3a9ea7156a3b09397bb3ebed8951b
parentbb3684703d50c0d84978135438eba3fb8780b2ac (diff)
downloadgcc-be3c93b01193a0811d38678c123ea3345af73e98.zip
gcc-be3c93b01193a0811d38678c123ea3345af73e98.tar.gz
gcc-be3c93b01193a0811d38678c123ea3345af73e98.tar.bz2
unordered_map (unordered_map<>::operator[](_Key&&)): Add.
2010-11-07 Paolo Carlini <paolo.carlini@oracle.com> * include/profile/unordered_map (unordered_map<>::operator[](_Key&&)): Add. From-SVN: r166420
-rw-r--r--libstdc++-v3/ChangeLog5
-rw-r--r--libstdc++-v3/include/profile/unordered_map20
2 files changed, 20 insertions, 5 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 1bc5dfa..d9156b1 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,5 +1,10 @@
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<>::
bitset(unsigned long long)): Add constexpr specifier.
diff --git a/libstdc++-v3/include/profile/unordered_map b/libstdc++-v3/include/profile/unordered_map
index 18563d8..49345cc 100644
--- a/libstdc++-v3/include/profile/unordered_map
+++ b/libstdc++-v3/include/profile/unordered_map
@@ -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)