[PATCH] Removing unused, non-standard function in _Rb_tree

Jonathan Wakely jwakely@redhat.com
Wed May 2 17:12:00 GMT 2018


We have an unused overload of _Rb_tree::erase which takes a pair of
pointers (not iterators, pointers) to keys and calls erase for every
key in the range.


It's not actually doing any harm, as the function is only on the
internal _Rb_tree type. It's not exposed as a member of std::map,
std::set etc. but it also isn't used anywhere, and I can't think where
it would be useful, so I propose to remove it.

Shout if you think we want to keep it.

	* include/bits/stl_tree.h (_Rb_tree::erase(const Key*, const Key*)):
	Remove unused, non-standard function.


-------------- next part --------------
commit 55b189d088ee1e343a9569234debeae82ce4005d
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Fri Dec 16 13:51:44 2016 +0000

    Removing unused, non-standard function in _Rb_tree
    
            * include/bits/stl_tree.h (_Rb_tree::erase(const Key*, const Key*)):
            Remove unused, non-standard function.

diff --git a/libstdc++-v3/include/bits/stl_tree.h b/libstdc++-v3/include/bits/stl_tree.h
index d0a8448eb0b..1c0fb97e028 100644
--- a/libstdc++-v3/include/bits/stl_tree.h
+++ b/libstdc++-v3/include/bits/stl_tree.h
@@ -1156,6 +1156,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	_M_erase_aux(__position);
       }
 #endif
+
       size_type
       erase(const key_type& __x);
 
@@ -1178,8 +1179,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       erase(const_iterator __first, const_iterator __last)
       { _M_erase_aux(__first, __last); }
 #endif
-      void
-      erase(const key_type* __first, const key_type* __last);
 
       void
       clear() _GLIBCXX_NOEXCEPT
@@ -2521,16 +2520,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   template<typename _Key, typename _Val, typename _KeyOfValue,
 	   typename _Compare, typename _Alloc>
-    void
-    _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
-    erase(const _Key* __first, const _Key* __last)
-    {
-      while (__first != __last)
-	erase(*__first++);
-    }
-
-  template<typename _Key, typename _Val, typename _KeyOfValue,
-	   typename _Compare, typename _Alloc>
     typename _Rb_tree<_Key, _Val, _KeyOfValue,
 		      _Compare, _Alloc>::iterator
     _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::


More information about the Libstdc++ mailing list