diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 1bc5dfab23b4..d9156b1b3806 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,8 @@ +2010-11-07 Paolo Carlini + + * include/profile/unordered_map (unordered_map<>::operator[](_Key&&)): + Add. + 2010-11-07 Paolo Carlini * include/profile/bitset (bitset<>::bitset(), bitset<>:: diff --git a/libstdc++-v3/include/profile/unordered_map b/libstdc++-v3/include/profile/unordered_map index 18563d875082..49345cc53aef 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) + operator[](const _Key& __k) { size_type __old_size = _Base::bucket_count(); - mapped_type& __res = _M_base()[_k]; + 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[](_Key&& __k) + { + size_type __old_size = _Base::bucket_count(); + 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)