stl_tree.h (_Rb_tree<>::erase(const _Key&)): Don't call std::distance unnecessarily.

2006-10-07  Ion Gaztanaga  <igaztanaga@gmail.com>
	    Paolo Carlini  <pcarlini@suse.de>

	* include/bits/stl_tree.h (_Rb_tree<>::erase(const _Key&)): Don't
	call std::distance unnecessarily.

Co-Authored-By: Paolo Carlini <pcarlini@suse.de>

From-SVN: r117529
This commit is contained in:
Ion Gaztanaga 2006-10-07 08:20:35 +00:00 committed by Paolo Carlini
parent defaac100c
commit 55ce980dc2
2 changed files with 9 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2006-10-07 Ion Gaztanaga <igaztanaga@gmail.com>
Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_tree.h (_Rb_tree<>::erase(const _Key&)): Don't
call std::distance unnecessarily.
2006-10-06 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29368

View File

@ -1269,10 +1269,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
erase(const _Key& __x)
{
pair<iterator,iterator> __p = equal_range(__x);
size_type __n = std::distance(__p.first, __p.second);
pair<iterator, iterator> __p = equal_range(__x);
const size_type __old_size = size();
erase(__p.first, __p.second);
return __n;
return __old_size - size();
}
template<typename _Key, typename _Val, typename _KoV,