diff options
Diffstat (limited to 'libstdc++-v3/include/bits/unordered_set.h')
-rw-r--r-- | libstdc++-v3/include/bits/unordered_set.h | 92 |
1 files changed, 50 insertions, 42 deletions
diff --git a/libstdc++-v3/include/bits/unordered_set.h b/libstdc++-v3/include/bits/unordered_set.h index 50dee215e16..260ad796c1a 100644 --- a/libstdc++-v3/include/bits/unordered_set.h +++ b/libstdc++-v3/include/bits/unordered_set.h @@ -56,6 +56,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) _Base; public: + typedef typename _Base::value_type value_type; typedef typename _Base::size_type size_type; typedef typename _Base::hasher hasher; typedef typename _Base::key_equal key_equal; @@ -68,22 +69,38 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) const allocator_type& __a = allocator_type()) : _Base(__n, __hf, __detail::_Mod_range_hashing(), __detail::_Default_ranged_hash(), __eql, - std::_Identity<_Value>(), __a) + std::_Identity<value_type>(), __a) { } template<typename _InputIterator> __unordered_set(_InputIterator __f, _InputIterator __l, - size_type __n = 10, + size_type __n = 0, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__f, __l, __n, __hf, __detail::_Mod_range_hashing(), __detail::_Default_ranged_hash(), __eql, - std::_Identity<_Value>(), __a) + std::_Identity<value_type>(), __a) { } - __unordered_set(__unordered_set&& __x) - : _Base(std::forward<_Base>(__x)) { } + __unordered_set(initializer_list<value_type> __l, + size_type __n = 0, + const hasher& __hf = hasher(), + const key_equal& __eql = key_equal(), + const allocator_type& __a = allocator_type()) + : _Base(__l.begin(), __l.end(), __n, __hf, + __detail::_Mod_range_hashing(), + __detail::_Default_ranged_hash(), __eql, + std::_Identity<value_type>(), __a) + { } + + __unordered_set& + operator=(initializer_list<value_type> __l) + { + this->clear(); + this->insert(__l.begin(), __l.end()); + return *this; + } }; template<class _Value, @@ -108,6 +125,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) _Base; public: + typedef typename _Base::value_type value_type; typedef typename _Base::size_type size_type; typedef typename _Base::hasher hasher; typedef typename _Base::key_equal key_equal; @@ -120,23 +138,39 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) const allocator_type& __a = allocator_type()) : _Base(__n, __hf, __detail::_Mod_range_hashing(), __detail::_Default_ranged_hash(), __eql, - std::_Identity<_Value>(), __a) + std::_Identity<value_type>(), __a) { } template<typename _InputIterator> __unordered_multiset(_InputIterator __f, _InputIterator __l, - typename _Base::size_type __n = 0, + size_type __n = 0, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__f, __l, __n, __hf, __detail::_Mod_range_hashing(), __detail::_Default_ranged_hash(), __eql, - std::_Identity<_Value>(), __a) + std::_Identity<value_type>(), __a) { } - __unordered_multiset(__unordered_multiset&& __x) - : _Base(std::forward<_Base>(__x)) { } + __unordered_multiset(initializer_list<value_type> __l, + size_type __n = 0, + const hasher& __hf = hasher(), + const key_equal& __eql = key_equal(), + const allocator_type& __a = allocator_type()) + : _Base(__l.begin(), __l.end(), __n, __hf, + __detail::_Mod_range_hashing(), + __detail::_Default_ranged_hash(), __eql, + std::_Identity<value_type>(), __a) + { } + + __unordered_multiset& + operator=(initializer_list<value_type> __l) + { + this->clear(); + this->insert(__l.begin(), __l.end()); + return *this; + } }; template<class _Value, class _Hash, class _Pred, class _Alloc, @@ -232,35 +266,22 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) template<typename _InputIterator> unordered_set(_InputIterator __f, _InputIterator __l, - size_type __n = 10, + size_type __n = 0, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__f, __l, __n, __hf, __eql, __a) { } - unordered_set(unordered_set&& __x) - : _Base(std::forward<_Base>(__x)) { } - unordered_set(initializer_list<value_type> __l, - size_type __n = 10, + size_type __n = 0, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) - : _Base(__l.begin(), __l.end(), __n, __hf, __eql, __a) + : _Base(__l.begin(), __l.end(), __n, __hf, __eql, __a) { } unordered_set& - operator=(unordered_set&& __x) - { - // NB: DR 1204. - // NB: DR 675. - this->clear(); - this->swap(__x); - return *this; - } - - unordered_set& operator=(initializer_list<value_type> __l) { this->clear(); @@ -311,35 +332,22 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) template<typename _InputIterator> unordered_multiset(_InputIterator __f, _InputIterator __l, - typename _Base::size_type __n = 0, + size_type __n = 0, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__f, __l, __n, __hf, __eql, __a) { } - unordered_multiset(unordered_multiset&& __x) - : _Base(std::forward<_Base>(__x)) { } - unordered_multiset(initializer_list<value_type> __l, - size_type __n = 10, + size_type __n = 0, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) - : _Base(__l.begin(), __l.end(), __n, __hf, __eql, __a) + : _Base(__l.begin(), __l.end(), __n, __hf, __eql, __a) { } unordered_multiset& - operator=(unordered_multiset&& __x) - { - // NB: DR 1204. - // NB: DR 675. - this->clear(); - this->swap(__x); - return *this; - } - - unordered_multiset& operator=(initializer_list<value_type> __l) { this->clear(); |