Commit be3c93b0 by Paolo Carlini Committed by Paolo Carlini

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
parent bb368470
2010-11-07 Paolo Carlini <paolo.carlini@oracle.com> 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<>:: * include/profile/bitset (bitset<>::bitset(), bitset<>::
bitset(unsigned long long)): Add constexpr specifier. bitset(unsigned long long)): Add constexpr specifier.
......
...@@ -232,17 +232,27 @@ namespace __profile ...@@ -232,17 +232,27 @@ namespace __profile
_Base::insert(__first, __last); _Base::insert(__first, __last);
_M_profile_resize(__old_size, _Base::bucket_count()); _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& mapped_type&
operator[](const _Key& _k) operator[](_Key&& __k)
{ {
size_type __old_size = _Base::bucket_count(); 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(); size_type __new_size = _Base::bucket_count();
_M_profile_resize(__old_size, _Base::bucket_count()); _M_profile_resize(__old_size, _Base::bucket_count());
return __res; return __res;
} }
void void
swap(unordered_map& __x) swap(unordered_map& __x)
......
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