2018-10-05 François Dumont <fdumont@gcc.gnu.org>
authorFrançois Dumont <fdumont@gcc.gnu.org>
Fri, 5 Oct 2018 16:01:39 +0000 (16:01 +0000)
committerFrançois Dumont <fdumont@gcc.gnu.org>
Fri, 5 Oct 2018 16:01:39 +0000 (16:01 +0000)
* 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

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/stl_tree.h
libstdc++-v3/include/debug/map.h
libstdc++-v3/include/debug/multimap.h
libstdc++-v3/include/debug/multiset.h
libstdc++-v3/include/debug/set.h

index 84e61ca955c047c71f63c4d5fdb4b91d39694a50..06718b5520d2a42ca0e8a20ede050be8750975fd 100644 (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
index 70d7483c7b17c4077e2ca212afb672c85cc0209d..87e57108deb83d2b091d432718d40f1b84cb94c8 100644 (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,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>
index a885859592b117b1dedc020347a4d5683254a938..6821fc561e45227d0c884bb8f54823c3d0bf0c3d 100644 (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"));
index 50500d66f7021464767c32d073e33cf4d399c7fe..d16ed47ab743884c68dd1deba0739163feb54eeb 100644 (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"));
index d292a14ca8c4ea0573942b4765c6356011ca1e79..bf154ecad6e0699aff51aa5390ce90bd0e5d044c 100644 (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"));
index ed75f0f174fe6da866b25157c28c8ebbd730e2ab..c406fb424f47d8be8b4bb13f41c31ff7297acebb 100644 (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"));