diff options
author | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-10-03 15:28:47 +0000 |
---|---|---|
committer | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-10-03 15:28:47 +0000 |
commit | 91101c32abad818347c4214a505a62dc897f4e3b (patch) | |
tree | edde729f626371b44609d6f3125611f726b76706 /libstdc++-v3 | |
parent | 6cf89e0496c6011f63a9bc1f9a37e09274f1f6ab (diff) | |
download | gcc-91101c32abad818347c4214a505a62dc897f4e3b.tar.gz |
2011-10-03 Paolo Carlini <paolo.carlini@oracle.com>
* include/bits/hashtable.h (_Hashtable<>::insert(value_type&&),
insert(const_iterator, value_type&&)): Don't define here...
* include/bits/unordered_set.h (__unordered_set<>,
__unordered_multiset<>): ... define here instead.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@179464 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3')
-rw-r--r-- | libstdc++-v3/ChangeLog | 9 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/hashtable.h | 42 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/unordered_set.h | 28 |
3 files changed, 51 insertions, 28 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 449f606f1be..31c69149733 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,7 +1,14 @@ +2011-10-03 Paolo Carlini <paolo.carlini@oracle.com> + + * include/bits/hashtable.h (_Hashtable<>::insert(value_type&&), + insert(const_iterator, value_type&&)): Don't define here... + * include/bits/unordered_set.h (__unordered_set<>, + __unordered_multiset<>): ... define here instead. + 2011-09-29 Jason Merrill <jason@redhat.com> * testsuite/util/testsuite_tr1.h (test_property): Avoid - ambguity. + ambiguity. 2011-10-01 François Dumont <fdumont@gcc.gnu.org> diff --git a/libstdc++-v3/include/bits/hashtable.h b/libstdc++-v3/include/bits/hashtable.h index a125f3eb80a..95d06b21262 100644 --- a/libstdc++-v3/include/bits/hashtable.h +++ b/libstdc++-v3/include/bits/hashtable.h @@ -374,14 +374,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _M_insert_bucket(_Arg&&, size_type, typename _Hashtable::_Hash_code_type); - template<typename _Arg> - std::pair<iterator, bool> - _M_insert(_Arg&&, std::true_type); - - template<typename _Arg> - iterator - _M_insert(_Arg&&, std::false_type); - typedef typename std::conditional<__unique_keys, std::pair<iterator, bool>, iterator>::type @@ -393,38 +385,38 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION >::type _Insert_Conv_Type; + protected: + template<typename _Arg> + std::pair<iterator, bool> + _M_insert(_Arg&&, std::true_type); + + template<typename _Arg> + iterator + _M_insert(_Arg&&, std::false_type); + public: // Insert and erase _Insert_Return_Type insert(const value_type& __v) - { return _M_insert(__v, std::integral_constant<bool, __unique_keys>()); } + { return _M_insert(__v, integral_constant<bool, __unique_keys>()); } iterator insert(const_iterator, const value_type& __v) { return _Insert_Conv_Type()(insert(__v)); } - _Insert_Return_Type - insert(value_type&& __v) - { return _M_insert(std::move(__v), - std::integral_constant<bool, __unique_keys>()); } - - iterator - 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> + std::enable_if<__and_<integral_constant<bool, !__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>()); } + integral_constant<bool, __unique_keys>()); } template<typename _Pair, typename = typename - std::enable_if<!__constant_iterators - && std::is_convertible<_Pair, - value_type>::value>::type> + std::enable_if<__and_<integral_constant<bool, !__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))); } diff --git a/libstdc++-v3/include/bits/unordered_set.h b/libstdc++-v3/include/bits/unordered_set.h index 38350bc390d..12b7bda138f 100644 --- a/libstdc++-v3/include/bits/unordered_set.h +++ b/libstdc++-v3/include/bits/unordered_set.h @@ -63,7 +63,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER typedef typename _Base::hasher hasher; typedef typename _Base::key_equal key_equal; typedef typename _Base::allocator_type allocator_type; - + typedef typename _Base::iterator iterator; + typedef typename _Base::const_iterator const_iterator; + explicit __unordered_set(size_type __n = 10, const hasher& __hf = hasher(), @@ -103,6 +105,16 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER this->insert(__l.begin(), __l.end()); return *this; } + + using _Base::insert; + + std::pair<iterator, bool> + insert(value_type&& __v) + { return this->_M_insert(std::move(__v), std::true_type()); } + + iterator + insert(const_iterator, value_type&& __v) + { return insert(std::move(__v)).first; } }; template<class _Value, @@ -132,7 +144,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER typedef typename _Base::hasher hasher; typedef typename _Base::key_equal key_equal; typedef typename _Base::allocator_type allocator_type; - + typedef typename _Base::iterator iterator; + typedef typename _Base::const_iterator const_iterator; + explicit __unordered_multiset(size_type __n = 10, const hasher& __hf = hasher(), @@ -173,6 +187,16 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER this->insert(__l.begin(), __l.end()); return *this; } + + using _Base::insert; + + iterator + insert(value_type&& __v) + { return this->_M_insert(std::move(__v), std::false_type()); } + + iterator + insert(const_iterator, value_type&& __v) + { return insert(std::move(__v)); } }; template<class _Value, class _Hash, class _Pred, class _Alloc, |