diff options
author | fdumont <fdumont@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-11-27 12:51:58 +0000 |
---|---|---|
committer | fdumont <fdumont@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-11-27 12:51:58 +0000 |
commit | 839ee5f6d817ce7f15768c657fbd5eca3f7f577a (patch) | |
tree | 3fa5d5b71b6a015b727c164df2e6d309705feb18 /libstdc++-v3/include | |
parent | db49621607d7c5d6f06e52561c8830e3a6be9442 (diff) | |
download | gcc-839ee5f6d817ce7f15768c657fbd5eca3f7f577a.tar.gz |
2010-11-27 François Dumont <francois.cppdevs@free.fr>
* include/debug/unordered_map, unordered_set (unordered_map<>::insert,
unordered_multimap<>::insert, unordered_set<>::insert,
unordered_multiset<>::insert) Debug check iterator hint and pass it to
normal implementation.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@167198 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include')
-rw-r--r-- | libstdc++-v3/include/debug/unordered_map | 27 | ||||
-rw-r--r-- | libstdc++-v3/include/debug/unordered_set | 28 |
2 files changed, 35 insertions, 20 deletions
diff --git a/libstdc++-v3/include/debug/unordered_map b/libstdc++-v3/include/debug/unordered_map index 29484c1ccdc..d7b139388b0 100644 --- a/libstdc++-v3/include/debug/unordered_map +++ b/libstdc++-v3/include/debug/unordered_map @@ -185,9 +185,10 @@ namespace __debug } iterator - insert(const_iterator, const value_type& __obj) + insert(const_iterator __hint, const value_type& __obj) { - return iterator(_Base::insert(__obj).first, this); + __glibcxx_check_insert(__hint); + return iterator(_Base::insert(__hint.base(), __obj), this); } template<typename _Pair, typename = typename @@ -205,9 +206,11 @@ namespace __debug std::enable_if<std::is_convertible<_Pair, value_type>::value>::type> iterator - insert(const_iterator, _Pair&& __obj) + insert(const_iterator __hint, _Pair&& __obj) { - return iterator(_Base::insert(std::forward<_Pair>(__obj)).first, + __glibcxx_check_insert(__hint); + return iterator(_Base::insert(__hint.base(), + std::forward<_Pair>(__obj)), this); } @@ -467,8 +470,11 @@ namespace __debug { return iterator(_Base::insert(__obj), this); } iterator - insert(const_iterator, const value_type& __obj) - { return iterator(_Base::insert(__obj), this); } + insert(const_iterator __hint, const value_type& __obj) + { + __glibcxx_check_insert(__hint); + return iterator(_Base::insert(__hint.base(), __obj), this); + } template<typename _Pair, typename = typename std::enable_if<std::is_convertible<_Pair, @@ -481,8 +487,13 @@ namespace __debug 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); } + insert(const_iterator __hint, _Pair&& __obj) + { + __glibcxx_check_insert(__hint); + return iterator(_Base::insert(__hint.base(), + std::forward<_Pair>(__obj)), + this); + } void insert(std::initializer_list<value_type> __l) diff --git a/libstdc++-v3/include/debug/unordered_set b/libstdc++-v3/include/debug/unordered_set index a606efec26f..e39cfa8f9a1 100644 --- a/libstdc++-v3/include/debug/unordered_set +++ b/libstdc++-v3/include/debug/unordered_set @@ -186,11 +186,10 @@ namespace __debug } iterator - insert(const_iterator, const value_type& __obj) + insert(const_iterator __hint, const value_type& __obj) { - typedef std::pair<_Base_iterator, bool> __pair_type; - __pair_type __res = _Base::insert(__obj); - return iterator(__res.first, this); + __glibcxx_check_insert(__hint); + return iterator(_Base::insert(__hint.base(), __obj), this); } std::pair<iterator, bool> @@ -202,11 +201,10 @@ namespace __debug } iterator - insert(const_iterator, value_type&& __obj) + insert(const_iterator __hint, 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); + __glibcxx_check_insert(__hint); + return iterator(_Base::insert(__hint.base(), std::move(__obj)), this); } void @@ -461,16 +459,22 @@ namespace __debug { return iterator(_Base::insert(__obj), this); } iterator - insert(const_iterator, const value_type& __obj) - { return iterator(_Base::insert(__obj), this); } + insert(const_iterator __hint, const value_type& __obj) + { + __glibcxx_check_insert(__hint); + return iterator(_Base::insert(__hint.base(), __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); } + insert(const_iterator __hint, value_type&& __obj) + { + __glibcxx_check_insert(__hint); + return iterator(_Base::insert(__hint.base(), std::move(__obj)), this); + } void insert(std::initializer_list<value_type> __l) |