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
This commit is contained in:
François Dumont 2018-10-05 16:01:39 +00:00
parent 825e64583e
commit e0b9bc230a
6 changed files with 77 additions and 80 deletions

View File

@ -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

View File

@ -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,56 +1604,38 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
}
#endif // C++17
friend bool
operator==(const _Rb_tree& __x, const _Rb_tree& __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 std::lexicographical_compare(__x.begin(), __x.end(),
__y.begin(), __y.end());
}
friend bool _GLIBCXX_DEPRECATED
operator!=(const _Rb_tree& __x, const _Rb_tree& __y)
{ return !(__x == __y); }
friend bool _GLIBCXX_DEPRECATED
operator>(const _Rb_tree& __x, const _Rb_tree& __y)
{ return __y < __x; }
friend bool _GLIBCXX_DEPRECATED
operator<=(const _Rb_tree& __x, const _Rb_tree& __y)
{ return !(__y < __x); }
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 __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());
}
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); }
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; }
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); }
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); }
template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc>
inline void

View File

@ -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"));

View File

@ -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"));

View File

@ -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"));

View File

@ -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"));