diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index c8318c6262e..2e5663d4ce0 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,10 @@ +2010-11-27 François Dumont + + * 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. + 2010-11-27 François Dumont * include/debug/bitset (bitset<>::reference): Clean code, use normal 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::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::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 __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 @@ -202,11 +201,10 @@ namespace __debug } iterator - insert(const_iterator, value_type&& __obj) + insert(const_iterator __hint, value_type&& __obj) { - typedef std::pair __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 __l)