aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrançois Dumont <fdumont@gcc.gnu.org>2018-10-05 16:01:39 +0000
committerFrançois Dumont <fdumont@gcc.gnu.org>2018-10-05 16:01:39 +0000
commite0b9bc230ac50c67c63f303b70e72b34a7c516fb (patch)
tree778e09bffcc8c7538cb36496379d62cca7e6d72f
parent825e64583e897682be613d48fb7d967288585dbd (diff)
downloadgcc-e0b9bc230ac50c67c63f303b70e72b34a7c516fb.zip
gcc-e0b9bc230ac50c67c63f303b70e72b34a7c516fb.tar.gz
gcc-e0b9bc230ac50c67c63f303b70e72b34a7c516fb.tar.bz2
2018-10-05 François Dumont <fdumont@gcc.gnu.org>
* include/bits/stl_tree.h (_Rb_tree_iterator<>::operator==): Make inline friend. (_Rb_tree_iterator<>::operator!=): Likewise. (_Rb_tree_const_iterator<>::operator==): Likewise. (_Rb_tree_const_iterator<>::operator!=): Likewise. (operator==(const _Rb_tree_iterator<>&, const _Rb_tree_const_iterator&)): Remove. (operator!=(const _Rb_tree_iterator<>&, const _Rb_tree_const_iterator&)): Remove. (operator==(const _Rb_tree<>&, const _Rb_tree<>&)): Make inline friend. (operator<(const _Rb_tree<>&, const _Rb_tree<>&)): Likewise. (operator!=(const _Rb_tree<>&, const _Rb_tree<>&)): Likewise and deprecate. (operator>(const _Rb_tree<>&, const _Rb_tree<>&)): Likewise. (operator<=(const _Rb_tree<>&, const _Rb_tree<>&)): Likewise. (operator>=(const _Rb_tree<>&, const _Rb_tree<>&)): Likewise. * include/debug/map.h (map<>::erase(const_iterator, const_iterator)): Compare __victim with _Base::cend(). * include/debug/multimap.h (multimap<>::erase(const_iterator, const_iterator)): Likewise. * include/debug/set.h (set<>::erase(const_iterator, const_iterator)): Compare __victim with _Base::cend(). * include/debug/multiset.h (multiset<>::erase(const_iterator, const_iterator)): Likewise. From-SVN: r264875
-rw-r--r--libstdc++-v3/ChangeLog27
-rw-r--r--libstdc++-v3/include/bits/stl_tree.h112
-rw-r--r--libstdc++-v3/include/debug/map.h2
-rw-r--r--libstdc++-v3/include/debug/multimap.h2
-rw-r--r--libstdc++-v3/include/debug/multiset.h2
-rw-r--r--libstdc++-v3/include/debug/set.h2
6 files changed, 72 insertions, 75 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 84e61ca..06718b5 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,30 @@
+2018-10-05 François Dumont <fdumont@gcc.gnu.org>
+
+ * include/bits/stl_tree.h
+ (_Rb_tree_iterator<>::operator==): Make inline friend.
+ (_Rb_tree_iterator<>::operator!=): Likewise.
+ (_Rb_tree_const_iterator<>::operator==): Likewise.
+ (_Rb_tree_const_iterator<>::operator!=): Likewise.
+ (operator==(const _Rb_tree_iterator<>&,
+ const _Rb_tree_const_iterator&)): Remove.
+ (operator!=(const _Rb_tree_iterator<>&,
+ const _Rb_tree_const_iterator&)): Remove.
+ (operator==(const _Rb_tree<>&, const _Rb_tree<>&)): Make inline friend.
+ (operator<(const _Rb_tree<>&, const _Rb_tree<>&)): Likewise.
+ (operator!=(const _Rb_tree<>&, const _Rb_tree<>&)): Likewise and
+ deprecate.
+ (operator>(const _Rb_tree<>&, const _Rb_tree<>&)): Likewise.
+ (operator<=(const _Rb_tree<>&, const _Rb_tree<>&)): Likewise.
+ (operator>=(const _Rb_tree<>&, const _Rb_tree<>&)): Likewise.
+ * include/debug/map.h (map<>::erase(const_iterator, const_iterator)):
+ Compare __victim with _Base::cend().
+ * include/debug/multimap.h
+ (multimap<>::erase(const_iterator, const_iterator)): Likewise.
+ * include/debug/set.h (set<>::erase(const_iterator, const_iterator)):
+ Compare __victim with _Base::cend().
+ * include/debug/multiset.h
+ (multiset<>::erase(const_iterator, const_iterator)): Likewise.
+
2018-10-03 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/59439
diff --git a/libstdc++-v3/include/bits/stl_tree.h b/libstdc++-v3/include/bits/stl_tree.h
index 70d7483..87e5710 100644
--- a/libstdc++-v3/include/bits/stl_tree.h
+++ b/libstdc++-v3/include/bits/stl_tree.h
@@ -260,11 +260,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
typedef _Tp* pointer;
typedef bidirectional_iterator_tag iterator_category;
- typedef ptrdiff_t difference_type;
+ typedef ptrdiff_t difference_type;
- typedef _Rb_tree_iterator<_Tp> _Self;
- typedef _Rb_tree_node_base::_Base_ptr _Base_ptr;
- typedef _Rb_tree_node<_Tp>* _Link_type;
+ typedef _Rb_tree_iterator<_Tp> _Self;
+ typedef _Rb_tree_node_base::_Base_ptr _Base_ptr;
+ typedef _Rb_tree_node<_Tp>* _Link_type;
_Rb_tree_iterator() _GLIBCXX_NOEXCEPT
: _M_node() { }
@@ -311,13 +311,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return __tmp;
}
- bool
- operator==(const _Self& __x) const _GLIBCXX_NOEXCEPT
- { return _M_node == __x._M_node; }
+ friend bool
+ operator==(const _Self& __x, const _Self& __y) _GLIBCXX_NOEXCEPT
+ { return __x._M_node == __y._M_node; }
- bool
- operator!=(const _Self& __x) const _GLIBCXX_NOEXCEPT
- { return _M_node != __x._M_node; }
+ friend bool
+ operator!=(const _Self& __x, const _Self& __y) _GLIBCXX_NOEXCEPT
+ { return __x._M_node != __y._M_node; }
_Base_ptr _M_node;
};
@@ -390,29 +390,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return __tmp;
}
- bool
- operator==(const _Self& __x) const _GLIBCXX_NOEXCEPT
- { return _M_node == __x._M_node; }
+ friend bool
+ operator==(const _Self& __x, const _Self& __y) _GLIBCXX_NOEXCEPT
+ { return __x._M_node == __y._M_node; }
- bool
- operator!=(const _Self& __x) const _GLIBCXX_NOEXCEPT
- { return _M_node != __x._M_node; }
+ friend bool
+ operator!=(const _Self& __x, const _Self& __y) _GLIBCXX_NOEXCEPT
+ { return __x._M_node != __y._M_node; }
_Base_ptr _M_node;
};
- template<typename _Val>
- inline bool
- operator==(const _Rb_tree_iterator<_Val>& __x,
- const _Rb_tree_const_iterator<_Val>& __y) _GLIBCXX_NOEXCEPT
- { return __x._M_node == __y._M_node; }
-
- template<typename _Val>
- inline bool
- operator!=(const _Rb_tree_iterator<_Val>& __x,
- const _Rb_tree_const_iterator<_Val>& __y) _GLIBCXX_NOEXCEPT
- { return __x._M_node != __y._M_node; }
-
void
_Rb_tree_insert_and_rebalance(const bool __insert_left,
_Rb_tree_node_base* __x,
@@ -1616,55 +1604,37 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
}
#endif // C++17
- };
- template<typename _Key, typename _Val, typename _KeyOfValue,
- typename _Compare, typename _Alloc>
- inline bool
- operator==(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,
- const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y)
- {
- return __x.size() == __y.size()
- && std::equal(__x.begin(), __x.end(), __y.begin());
- }
+ friend bool
+ operator==(const _Rb_tree& __x, const _Rb_tree& __y)
+ {
+ return __x.size() == __y.size()
+ && std::equal(__x.begin(), __x.end(), __y.begin());
+ }
- template<typename _Key, typename _Val, typename _KeyOfValue,
- typename _Compare, typename _Alloc>
- inline bool
- operator<(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,
- const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y)
- {
- return std::lexicographical_compare(__x.begin(), __x.end(),
- __y.begin(), __y.end());
- }
+ friend bool
+ operator<(const _Rb_tree& __x, const _Rb_tree& __y)
+ {
+ return std::lexicographical_compare(__x.begin(), __x.end(),
+ __y.begin(), __y.end());
+ }
- template<typename _Key, typename _Val, typename _KeyOfValue,
- typename _Compare, typename _Alloc>
- inline bool
- operator!=(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,
- const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y)
- { return !(__x == __y); }
+ friend bool _GLIBCXX_DEPRECATED
+ operator!=(const _Rb_tree& __x, const _Rb_tree& __y)
+ { return !(__x == __y); }
- template<typename _Key, typename _Val, typename _KeyOfValue,
- typename _Compare, typename _Alloc>
- inline bool
- operator>(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,
- const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y)
- { return __y < __x; }
+ friend bool _GLIBCXX_DEPRECATED
+ operator>(const _Rb_tree& __x, const _Rb_tree& __y)
+ { return __y < __x; }
- template<typename _Key, typename _Val, typename _KeyOfValue,
- typename _Compare, typename _Alloc>
- inline bool
- operator<=(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,
- const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y)
- { return !(__y < __x); }
+ friend bool _GLIBCXX_DEPRECATED
+ operator<=(const _Rb_tree& __x, const _Rb_tree& __y)
+ { return !(__y < __x); }
- template<typename _Key, typename _Val, typename _KeyOfValue,
- typename _Compare, typename _Alloc>
- inline bool
- operator>=(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,
- const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y)
- { return !(__x < __y); }
+ friend bool _GLIBCXX_DEPRECATED
+ operator>=(const _Rb_tree& __x, const _Rb_tree& __y)
+ { return !(__x < __y); }
+ };
template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc>
diff --git a/libstdc++-v3/include/debug/map.h b/libstdc++-v3/include/debug/map.h
index a885859..6821fc5 100644
--- a/libstdc++-v3/include/debug/map.h
+++ b/libstdc++-v3/include/debug/map.h
@@ -519,7 +519,7 @@ namespace __debug
for (_Base_const_iterator __victim = __first.base();
__victim != __last.base(); ++__victim)
{
- _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(),
+ _GLIBCXX_DEBUG_VERIFY(__victim != _Base::cend(),
_M_message(__gnu_debug::__msg_valid_range)
._M_iterator(__first, "first")
._M_iterator(__last, "last"));
diff --git a/libstdc++-v3/include/debug/multimap.h b/libstdc++-v3/include/debug/multimap.h
index 50500d6..d16ed47 100644
--- a/libstdc++-v3/include/debug/multimap.h
+++ b/libstdc++-v3/include/debug/multimap.h
@@ -400,7 +400,7 @@ namespace __debug
for (_Base_const_iterator __victim = __first.base();
__victim != __last.base(); ++__victim)
{
- _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(),
+ _GLIBCXX_DEBUG_VERIFY(__victim != _Base::cend(),
_M_message(__gnu_debug::__msg_valid_range)
._M_iterator(__first, "first")
._M_iterator(__last, "last"));
diff --git a/libstdc++-v3/include/debug/multiset.h b/libstdc++-v3/include/debug/multiset.h
index d292a14..bf154ec 100644
--- a/libstdc++-v3/include/debug/multiset.h
+++ b/libstdc++-v3/include/debug/multiset.h
@@ -367,7 +367,7 @@ namespace __debug
for (_Base_const_iterator __victim = __first.base();
__victim != __last.base(); ++__victim)
{
- _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(),
+ _GLIBCXX_DEBUG_VERIFY(__victim != _Base::cend(),
_M_message(__gnu_debug::__msg_valid_range)
._M_iterator(__first, "first")
._M_iterator(__last, "last"));
diff --git a/libstdc++-v3/include/debug/set.h b/libstdc++-v3/include/debug/set.h
index ed75f0f..c406fb4 100644
--- a/libstdc++-v3/include/debug/set.h
+++ b/libstdc++-v3/include/debug/set.h
@@ -379,7 +379,7 @@ namespace __debug
for (_Base_const_iterator __victim = __first.base();
__victim != __last.base(); ++__victim)
{
- _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(),
+ _GLIBCXX_DEBUG_VERIFY(__victim != _Base::cend(),
_M_message(__gnu_debug::__msg_valid_range)
._M_iterator(__first, "first")
._M_iterator(__last, "last"));