This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [v3] PR libstdc++/50529


Hi

I would like to complete this patch with the attached one. As soon as vector or deque iterators have been validated thanks to the __glibcxx_check_* macros it is safe and more efficient to operate on normal iterators.

2011-09-29 François Dumont <fdumont@gcc.gnu.org>

* include/debug/vector (vector<>::erase(iterator, iterator): Check
iterators equality using normal iterators.
* include/debug/deque (deque<>::erase(iterator, iterator): Likewise.


Ok to commit ?

François


On 09/27/2011 04:41 AM, Paolo Carlini wrote:
Hi,

pretty straightforward, tested x86_64-linux, committed to mainline.

Thanks,
Paolo.

///////////////////


Index: include/debug/vector
===================================================================
--- include/debug/vector	(revision 179319)
+++ include/debug/vector	(working copy)
@@ -499,7 +499,7 @@
 	// 151. can't currently clear() empty container
 	__glibcxx_check_erase_range(__first, __last);
 
-	if (__first != __last)
+	if (__first.base() != __last.base())
 	  {
 	    difference_type __offset = __first.base() - _Base::begin();
 	    _Base_iterator __res = _Base::erase(__first.base(),
Index: include/debug/deque
===================================================================
--- include/debug/deque	(revision 179319)
+++ include/debug/deque	(working copy)
@@ -465,7 +465,7 @@
 	// 151. can't currently clear() empty container
 	__glibcxx_check_erase_range(__first, __last);
 
-	if (__first == __last)
+	if (__first.base() == __last.base())
 	  return __first;
         else if (__first.base() == _Base::begin()
 		 || __last.base() == _Base::end())


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]