summaryrefslogtreecommitdiff
path: root/libstdc++-v3/include
diff options
context:
space:
mode:
Diffstat (limited to 'libstdc++-v3/include')
-rw-r--r--libstdc++-v3/include/bits/hashtable.h295
-rw-r--r--libstdc++-v3/include/bits/hashtable_policy.h25
-rw-r--r--libstdc++-v3/include/bits/stl_function.h12
-rw-r--r--libstdc++-v3/include/debug/unordered_map36
-rw-r--r--libstdc++-v3/include/debug/unordered_set24
-rw-r--r--libstdc++-v3/include/profile/unordered_map51
-rw-r--r--libstdc++-v3/include/profile/unordered_set40
7 files changed, 348 insertions, 135 deletions
diff --git a/libstdc++-v3/include/bits/hashtable.h b/libstdc++-v3/include/bits/hashtable.h
index dd8c1c22349..343a12267fd 100644
--- a/libstdc++-v3/include/bits/hashtable.h
+++ b/libstdc++-v3/include/bits/hashtable.h
@@ -178,9 +178,10 @@ namespace std
size_type _M_begin_bucket_index; // First non-empty bucket.
size_type _M_element_count;
_RehashPolicy _M_rehash_policy;
-
- _Node*
- _M_allocate_node(const value_type& __v);
+
+ template<typename... _Args>
+ _Node*
+ _M_allocate_node(_Args&&... __args);
void
_M_deallocate_node(_Node* __n);
@@ -360,11 +361,27 @@ namespace std
std::pair<const_iterator, const_iterator>
equal_range(const key_type& __k) const;
- private: // Find, insert and erase helper functions
- // ??? This dispatching is a workaround for the fact that we don't
- // have partial specialization of member templates; it would be
- // better to just specialize insert on __unique_keys. There may be a
- // cleaner workaround.
+ private:
+ // Find, insert and erase helper functions
+ _Node*
+ _M_find_node(_Node*, const key_type&,
+ typename _Hashtable::_Hash_code_type) const;
+
+ template<typename _Pair>
+ iterator
+ _M_insert_bucket(_Pair&&, size_type,
+ typename _Hashtable::_Hash_code_type);
+
+ template<typename _Pair>
+ std::pair<iterator, bool>
+ _M_insert(_Pair&&, std::true_type);
+
+ template<typename _Pair>
+ iterator
+ _M_insert(_Pair&&, std::false_type);
+
+ public:
+ // Insert and erase
typedef typename std::conditional<__unique_keys,
std::pair<iterator, bool>,
iterator>::type
@@ -376,30 +393,39 @@ namespace std
>::type
_Insert_Conv_Type;
- _Node*
- _M_find_node(_Node*, const key_type&,
- typename _Hashtable::_Hash_code_type) const;
-
- iterator
- _M_insert_bucket(const value_type&, size_type,
- typename _Hashtable::_Hash_code_type);
-
- std::pair<iterator, bool>
- _M_insert(const value_type&, std::true_type);
+ _Insert_Return_Type
+ insert(const value_type& __v)
+ { return _M_insert(__v, std::integral_constant<bool, __unique_keys>()); }
iterator
- _M_insert(const value_type&, std::false_type);
+ insert(const_iterator, const value_type& __v)
+ { return _Insert_Conv_Type()(insert(__v)); }
- public:
- // Insert and erase
_Insert_Return_Type
- insert(const value_type& __v)
- { return _M_insert(__v, std::integral_constant<bool,
- __unique_keys>()); }
+ insert(value_type&& __v)
+ { return _M_insert(std::move(__v),
+ std::integral_constant<bool, __unique_keys>()); }
iterator
- insert(const_iterator, const value_type& __v)
- { return iterator(_Insert_Conv_Type()(this->insert(__v))); }
+ insert(const_iterator, value_type&& __v)
+ { return _Insert_Conv_Type()(insert(std::move(__v))); }
+
+ template<typename _Pair, typename = typename
+ std::enable_if<!__constant_iterators
+ && std::is_convertible<_Pair,
+ value_type>::value>::type>
+ _Insert_Return_Type
+ insert(_Pair&& __v)
+ { return _M_insert(std::forward<_Pair>(__v),
+ std::integral_constant<bool, __unique_keys>()); }
+
+ template<typename _Pair, typename = typename
+ std::enable_if<!__constant_iterators
+ && std::is_convertible<_Pair,
+ value_type>::value>::type>
+ iterator
+ insert(const_iterator, _Pair&& __v)
+ { return _Insert_Conv_Type()(insert(std::forward<_Pair>(__v))); }
template<typename _InputIterator>
void
@@ -438,26 +464,27 @@ namespace std
typename _Allocator, typename _ExtractKey, typename _Equal,
typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
bool __chc, bool __cit, bool __uk>
- typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
- _H1, _H2, _Hash, _RehashPolicy,
- __chc, __cit, __uk>::_Node*
- _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
- _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
- _M_allocate_node(const value_type& __v)
- {
- _Node* __n = _M_node_allocator.allocate(1);
- __try
- {
- _M_node_allocator.construct(__n, __v);
- __n->_M_next = 0;
- return __n;
- }
- __catch(...)
- {
- _M_node_allocator.deallocate(__n, 1);
- __throw_exception_again;
- }
- }
+ template<typename... _Args>
+ typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy,
+ __chc, __cit, __uk>::_Node*
+ _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
+ _M_allocate_node(_Args&&... __args)
+ {
+ _Node* __n = _M_node_allocator.allocate(1);
+ __try
+ {
+ _M_node_allocator.construct(__n, std::forward<_Args>(__args)...);
+ __n->_M_next = 0;
+ return __n;
+ }
+ __catch(...)
+ {
+ _M_node_allocator.deallocate(__n, 1);
+ __throw_exception_again;
+ }
+ }
template<typename _Key, typename _Value,
typename _Allocator, typename _ExtractKey, typename _Equal,
@@ -871,111 +898,117 @@ namespace std
typename _Allocator, typename _ExtractKey, typename _Equal,
typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
bool __chc, bool __cit, bool __uk>
- typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
- _H1, _H2, _Hash, _RehashPolicy,
- __chc, __cit, __uk>::iterator
- _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
- _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
- _M_insert_bucket(const value_type& __v, size_type __n,
- typename _Hashtable::_Hash_code_type __code)
- {
- std::pair<bool, std::size_t> __do_rehash
- = _M_rehash_policy._M_need_rehash(_M_bucket_count,
- _M_element_count, 1);
+ template<typename _Pair>
+ typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy,
+ __chc, __cit, __uk>::iterator
+ _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
+ _M_insert_bucket(_Pair&& __v, size_type __n,
+ typename _Hashtable::_Hash_code_type __code)
+ {
+ std::pair<bool, std::size_t> __do_rehash
+ = _M_rehash_policy._M_need_rehash(_M_bucket_count,
+ _M_element_count, 1);
- // Allocate the new node before doing the rehash so that we don't
- // do a rehash if the allocation throws.
- _Node* __new_node = _M_allocate_node(__v);
+ if (__do_rehash.first)
+ {
+ const key_type& __k = this->_M_extract(__v);
+ __n = this->_M_bucket_index(__k, __code, __do_rehash.second);
+ }
- __try
- {
- if (__do_rehash.first)
- {
- const key_type& __k = this->_M_extract(__v);
- __n = this->_M_bucket_index(__k, __code, __do_rehash.second);
+ // Allocate the new node before doing the rehash so that we don't
+ // do a rehash if the allocation throws.
+ _Node* __new_node = _M_allocate_node(std::forward<_Pair>(__v));
+
+ __try
+ {
+ if (__do_rehash.first)
_M_rehash(__do_rehash.second);
- }
- __new_node->_M_next = _M_buckets[__n];
- this->_M_store_code(__new_node, __code);
- _M_buckets[__n] = __new_node;
- ++_M_element_count;
- if (__n < _M_begin_bucket_index)
- _M_begin_bucket_index = __n;
- return iterator(__new_node, _M_buckets + __n);
- }
- __catch(...)
- {
- _M_deallocate_node(__new_node);
- __throw_exception_again;
- }
- }
+ __new_node->_M_next = _M_buckets[__n];
+ this->_M_store_code(__new_node, __code);
+ _M_buckets[__n] = __new_node;
+ ++_M_element_count;
+ if (__n < _M_begin_bucket_index)
+ _M_begin_bucket_index = __n;
+ return iterator(__new_node, _M_buckets + __n);
+ }
+ __catch(...)
+ {
+ _M_deallocate_node(__new_node);
+ __throw_exception_again;
+ }
+ }
// Insert v if no element with its key is already present.
template<typename _Key, typename _Value,
typename _Allocator, typename _ExtractKey, typename _Equal,
typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
bool __chc, bool __cit, bool __uk>
- std::pair<typename _Hashtable<_Key, _Value, _Allocator,
- _ExtractKey, _Equal, _H1,
- _H2, _Hash, _RehashPolicy,
- __chc, __cit, __uk>::iterator, bool>
- _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
- _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
- _M_insert(const value_type& __v, std::true_type)
- {
- const key_type& __k = this->_M_extract(__v);
- typename _Hashtable::_Hash_code_type __code = this->_M_hash_code(__k);
- size_type __n = this->_M_bucket_index(__k, __code, _M_bucket_count);
-
- if (_Node* __p = _M_find_node(_M_buckets[__n], __k, __code))
- return std::make_pair(iterator(__p, _M_buckets + __n), false);
- return std::make_pair(_M_insert_bucket(__v, __n, __code), true);
- }
+ template<typename _Pair>
+ std::pair<typename _Hashtable<_Key, _Value, _Allocator,
+ _ExtractKey, _Equal, _H1,
+ _H2, _Hash, _RehashPolicy,
+ __chc, __cit, __uk>::iterator, bool>
+ _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
+ _M_insert(_Pair&& __v, std::true_type)
+ {
+ const key_type& __k = this->_M_extract(__v);
+ typename _Hashtable::_Hash_code_type __code = this->_M_hash_code(__k);
+ size_type __n = this->_M_bucket_index(__k, __code, _M_bucket_count);
+
+ if (_Node* __p = _M_find_node(_M_buckets[__n], __k, __code))
+ return std::make_pair(iterator(__p, _M_buckets + __n), false);
+ return std::make_pair(_M_insert_bucket(std::forward<_Pair>(__v),
+ __n, __code), true);
+ }
// Insert v unconditionally.
template<typename _Key, typename _Value,
typename _Allocator, typename _ExtractKey, typename _Equal,
typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,
bool __chc, bool __cit, bool __uk>
- typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
- _H1, _H2, _Hash, _RehashPolicy,
- __chc, __cit, __uk>::iterator
- _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
- _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
- _M_insert(const value_type& __v, std::false_type)
- {
- std::pair<bool, std::size_t> __do_rehash
- = _M_rehash_policy._M_need_rehash(_M_bucket_count,
- _M_element_count, 1);
- if (__do_rehash.first)
- _M_rehash(__do_rehash.second);
+ template<typename _Pair>
+ typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy,
+ __chc, __cit, __uk>::iterator
+ _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
+ _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
+ _M_insert(_Pair&& __v, std::false_type)
+ {
+ std::pair<bool, std::size_t> __do_rehash
+ = _M_rehash_policy._M_need_rehash(_M_bucket_count,
+ _M_element_count, 1);
+ if (__do_rehash.first)
+ _M_rehash(__do_rehash.second);
- const key_type& __k = this->_M_extract(__v);
- typename _Hashtable::_Hash_code_type __code = this->_M_hash_code(__k);
- size_type __n = this->_M_bucket_index(__k, __code, _M_bucket_count);
+ const key_type& __k = this->_M_extract(__v);
+ typename _Hashtable::_Hash_code_type __code = this->_M_hash_code(__k);
+ size_type __n = this->_M_bucket_index(__k, __code, _M_bucket_count);
- // First find the node, avoid leaking new_node if compare throws.
- _Node* __prev = _M_find_node(_M_buckets[__n], __k, __code);
- _Node* __new_node = _M_allocate_node(__v);
+ // First find the node, avoid leaking new_node if compare throws.
+ _Node* __prev = _M_find_node(_M_buckets[__n], __k, __code);
+ _Node* __new_node = _M_allocate_node(std::forward<_Pair>(__v));
- if (__prev)
- {
- __new_node->_M_next = __prev->_M_next;
- __prev->_M_next = __new_node;
- }
- else
- {
- __new_node->_M_next = _M_buckets[__n];
- _M_buckets[__n] = __new_node;
- if (__n < _M_begin_bucket_index)
- _M_begin_bucket_index = __n;
- }
- this->_M_store_code(__new_node, __code);
+ if (__prev)
+ {
+ __new_node->_M_next = __prev->_M_next;
+ __prev->_M_next = __new_node;
+ }
+ else
+ {
+ __new_node->_M_next = _M_buckets[__n];
+ _M_buckets[__n] = __new_node;
+ if (__n < _M_begin_bucket_index)
+ _M_begin_bucket_index = __n;
+ }
+ this->_M_store_code(__new_node, __code);
- ++_M_element_count;
- return iterator(__new_node, _M_buckets + __n);
- }
+ ++_M_element_count;
+ return iterator(__new_node, _M_buckets + __n);
+ }
template<typename _Key, typename _Value,
typename _Allocator, typename _ExtractKey, typename _Equal,
diff --git a/libstdc++-v3/include/bits/hashtable_policy.h b/libstdc++-v3/include/bits/hashtable_policy.h
index 694d0ffdeb4..d8d2af5d64e 100644
--- a/libstdc++-v3/include/bits/hashtable_policy.h
+++ b/libstdc++-v3/include/bits/hashtable_policy.h
@@ -497,7 +497,7 @@ namespace __detail
// the form pair<T1, T2> and a key extraction policy that returns the
// first part of the pair, the hashtable gets a mapped_type typedef.
// If it satisfies those criteria and also has unique keys, then it
- // also gets an operator[].
+ // also gets an operator[].
template<typename _Key, typename _Value, typename _Ex, bool __unique,
typename _Hashtable>
struct _Map_base { };
@@ -516,6 +516,9 @@ namespace __detail
mapped_type&
operator[](const _Key& __k);
+ mapped_type&
+ operator[](_Key&& __k);
+
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// DR 761. unordered_map needs an at() member function.
mapped_type&
@@ -548,6 +551,26 @@ namespace __detail
typename _Map_base<_Key, _Pair, std::_Select1st<_Pair>,
true, _Hashtable>::mapped_type&
_Map_base<_Key, _Pair, std::_Select1st<_Pair>, true, _Hashtable>::
+ operator[](_Key&& __k)
+ {
+ _Hashtable* __h = static_cast<_Hashtable*>(this);
+ typename _Hashtable::_Hash_code_type __code = __h->_M_hash_code(__k);
+ std::size_t __n = __h->_M_bucket_index(__k, __code,
+ __h->_M_bucket_count);
+
+ typename _Hashtable::_Node* __p =
+ __h->_M_find_node(__h->_M_buckets[__n], __k, __code);
+ if (!__p)
+ return __h->_M_insert_bucket(std::make_pair(std::move(__k),
+ mapped_type()),
+ __n, __code)->second;
+ return (__p->_M_v).second;
+ }
+
+ template<typename _Key, typename _Pair, typename _Hashtable>
+ typename _Map_base<_Key, _Pair, std::_Select1st<_Pair>,
+ true, _Hashtable>::mapped_type&
+ _Map_base<_Key, _Pair, std::_Select1st<_Pair>, true, _Hashtable>::
at(const _Key& __k)
{
_Hashtable* __h = static_cast<_Hashtable*>(this);
diff --git a/libstdc++-v3/include/bits/stl_function.h b/libstdc++-v3/include/bits/stl_function.h
index fd9c3589d69..a5f5e255825 100644
--- a/libstdc++-v3/include/bits/stl_function.h
+++ b/libstdc++-v3/include/bits/stl_function.h
@@ -487,6 +487,18 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
const typename _Pair::first_type&
operator()(const _Pair& __x) const
{ return __x.first; }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Pair2>
+ typename _Pair2::first_type&
+ operator()(_Pair2& __x) const
+ { return __x.first; }
+
+ template<typename _Pair2>
+ const typename _Pair2::first_type&
+ operator()(const _Pair2& __x) const
+ { return __x.first; }
+#endif
};
template<typename _Pair>
diff --git a/libstdc++-v3/include/debug/unordered_map b/libstdc++-v3/include/debug/unordered_map
index 2e2f9122ee0..6f37e040a26 100644
--- a/libstdc++-v3/include/debug/unordered_map
+++ b/libstdc++-v3/include/debug/unordered_map
@@ -190,6 +190,28 @@ namespace __debug
return iterator(__res.first, this);
}
+ template<typename _Pair, typename = typename
+ std::enable_if<std::is_convertible<_Pair,
+ value_type>::value>::type>
+ std::pair<iterator, bool>
+ insert(_Pair&& __obj)
+ {
+ typedef std::pair<typename _Base::iterator, bool> __pair_type;
+ __pair_type __res = _Base::insert(std::forward<_Pair>(__obj));
+ return std::make_pair(iterator(__res.first, this), __res.second);
+ }
+
+ template<typename _Pair, typename = typename
+ std::enable_if<std::is_convertible<_Pair,
+ value_type>::value>::type>
+ iterator
+ insert(const_iterator, _Pair&& __obj)
+ {
+ typedef std::pair<typename _Base::iterator, bool> __pair_type;
+ __pair_type __res = _Base::insert(std::forward<_Pair>(__obj));
+ return iterator(__res.first, this);
+ }
+
void
insert(std::initializer_list<value_type> __l)
{ _Base::insert(__l); }
@@ -444,6 +466,20 @@ namespace __debug
insert(const_iterator, const value_type& __obj)
{ return iterator(_Base::insert(__obj), this); }
+ template<typename _Pair, typename = typename
+ std::enable_if<std::is_convertible<_Pair,
+ value_type>::value>::type>
+ iterator
+ insert(_Pair&& __obj)
+ { return iterator(_Base::insert(std::forward<_Pair>(__obj)), this); }
+
+ template<typename _Pair, typename = typename
+ std::enable_if<std::is_convertible<_Pair,
+ value_type>::value>::type>
+ iterator
+ insert(const_iterator, _Pair&& __obj)
+ { return iterator(_Base::insert(std::forward<_Pair>(__obj)), this); }
+
void
insert(std::initializer_list<value_type> __l)
{ _Base::insert(__l); }
diff --git a/libstdc++-v3/include/debug/unordered_set b/libstdc++-v3/include/debug/unordered_set
index ea90c675476..1d42905e236 100644
--- a/libstdc++-v3/include/debug/unordered_set
+++ b/libstdc++-v3/include/debug/unordered_set
@@ -190,6 +190,22 @@ namespace __debug
return iterator(__res.first, this);
}
+ std::pair<iterator, bool>
+ insert(value_type&& __obj)
+ {
+ typedef std::pair<typename _Base::iterator, bool> __pair_type;
+ __pair_type __res = _Base::insert(std::move(__obj));
+ return std::make_pair(iterator(__res.first, this), __res.second);
+ }
+
+ iterator
+ insert(const_iterator, value_type&& __obj)
+ {
+ typedef std::pair<typename _Base::iterator, bool> __pair_type;
+ __pair_type __res = _Base::insert(std::move(__obj));
+ return iterator(__res.first, this);
+ }
+
void
insert(std::initializer_list<value_type> __l)
{ _Base::insert(__l); }
@@ -440,6 +456,14 @@ namespace __debug
insert(const_iterator, const value_type& __obj)
{ return iterator(_Base::insert(__obj), this); }
+ iterator
+ insert(value_type&& __obj)
+ { return iterator(_Base::insert(std::move(__obj)), this); }
+
+ iterator
+ insert(const_iterator, value_type&& __obj)
+ { return iterator(_Base::insert(std::move(__obj)), this); }
+
void
insert(std::initializer_list<value_type> __l)
{ _Base::insert(__l); }
diff --git a/libstdc++-v3/include/profile/unordered_map b/libstdc++-v3/include/profile/unordered_map
index 2dec1f2a268..18563d87508 100644
--- a/libstdc++-v3/include/profile/unordered_map
+++ b/libstdc++-v3/include/profile/unordered_map
@@ -191,6 +191,31 @@ namespace __profile
return __res;
}
+ template<typename _Pair, typename = typename
+ std::enable_if<std::is_convertible<_Pair,
+ value_type>::value>::type>
+ std::pair<iterator, bool>
+ insert(_Pair&& __obj)
+ {
+ size_type __old_size = _Base::bucket_count();
+ std::pair<iterator, bool> __res
+ = _Base::insert(std::forward<_Pair>(__obj));
+ _M_profile_resize(__old_size, _Base::bucket_count());
+ return __res;
+ }
+
+ template<typename _Pair, typename = typename
+ std::enable_if<std::is_convertible<_Pair,
+ value_type>::value>::type>
+ iterator
+ insert(const_iterator __iter, _Pair&& __v)
+ {
+ size_type __old_size = _Base::bucket_count();
+ iterator __res = _Base::insert(__iter, std::forward<_Pair>(__v));
+ _M_profile_resize(__old_size, _Base::bucket_count());
+ return __res;
+ }
+
template<typename _InputIter>
void
insert(_InputIter __first, _InputIter __last)
@@ -420,11 +445,35 @@ namespace __profile
insert(const_iterator __iter, const value_type& __v)
{
size_type __old_size = _Base::bucket_count();
- iterator __res =_Base::insert(__iter, __v);
+ iterator __res = _Base::insert(__iter, __v);
_M_profile_resize(__old_size, _Base::bucket_count());
return __res;
}
+ template<typename _Pair, typename = typename
+ std::enable_if<std::is_convertible<_Pair,
+ value_type>::value>::type>
+ iterator
+ insert(_Pair&& __obj)
+ {
+ size_type __old_size = _Base::bucket_count();
+ iterator __res = _Base::insert(std::forward<_Pair>(__obj));
+ _M_profile_resize(__old_size, _Base::bucket_count());
+ return __res;
+ }
+
+ template<typename _Pair, typename = typename
+ std::enable_if<std::is_convertible<_Pair,
+ value_type>::value>::type>
+ iterator
+ insert(const_iterator __iter, _Pair&& __v)
+ {
+ size_type __old_size = _Base::bucket_count();
+ iterator __res = _Base::insert(__iter, std::forward<_Pair>(__v));
+ _M_profile_resize(__old_size, _Base::bucket_count());
+ return __res;
+ }
+
template<typename _InputIter>
void
insert(_InputIter __first, _InputIter __last)
diff --git a/libstdc++-v3/include/profile/unordered_set b/libstdc++-v3/include/profile/unordered_set
index 2dade092024..f46cf5c8bdd 100644
--- a/libstdc++-v3/include/profile/unordered_set
+++ b/libstdc++-v3/include/profile/unordered_set
@@ -174,7 +174,7 @@ namespace __profile
std::pair<iterator, bool>
insert(const value_type& __obj)
{
- size_type __old_size = _Base::bucket_count();
+ size_type __old_size = _Base::bucket_count();
std::pair<iterator, bool> __res = _Base::insert(__obj);
_M_profile_resize(__old_size, _Base::bucket_count());
return __res;
@@ -189,6 +189,24 @@ namespace __profile
return __res;
}
+ std::pair<iterator, bool>
+ insert(value_type&& __obj)
+ {
+ size_type __old_size = _Base::bucket_count();
+ std::pair<iterator, bool> __res = _Base::insert(std::move(__obj));
+ _M_profile_resize(__old_size, _Base::bucket_count());
+ return __res;
+ }
+
+ iterator
+ insert(const_iterator __iter, value_type&& __v)
+ {
+ size_type __old_size = _Base::bucket_count();
+ iterator __res = _Base::insert(__iter, std::move(__v));
+ _M_profile_resize(__old_size, _Base::bucket_count());
+ return __res;
+ }
+
template<typename _InputIter>
void
insert(_InputIter __first, _InputIter __last)
@@ -406,13 +424,31 @@ namespace __profile
iterator
insert(const_iterator __iter, const value_type& __v)
- {
+ {
size_type __old_size = _Base::bucket_count();
iterator __res = _Base::insert(__iter, __v);
_M_profile_resize(__old_size, _Base::bucket_count());
return __res;
}
+ iterator
+ insert(value_type&& __obj)
+ {
+ size_type __old_size = _Base::bucket_count();
+ iterator __res = _Base::insert(std::move(__obj));
+ _M_profile_resize(__old_size, _Base::bucket_count());
+ return __res;
+ }
+
+ iterator
+ insert(const_iterator __iter, value_type&& __v)
+ {
+ size_type __old_size = _Base::bucket_count();
+ iterator __res = _Base::insert(__iter, std::move(__v));
+ _M_profile_resize(__old_size, _Base::bucket_count());
+ return __res;
+ }
+
template<typename _InputIter>
void
insert(_InputIter __first, _InputIter __last)