stl_algo.h (search_n): Improve the previous fix as suggested by Martin.

2003-09-29  Paolo Carlini  <pcarlini@unitus.it>

	* include/bits/stl_algo.h (search_n): Improve the previous
	fix as suggested by Martin.

From-SVN: r71913
This commit is contained in:
Paolo Carlini 2003-09-29 21:43:04 +02:00 committed by Paolo Carlini
parent 3ec278de0b
commit 6821a40b74
2 changed files with 9 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2003-09-29 Paolo Carlini <pcarlini@unitus.it>
* include/bits/stl_algo.h (search_n): Improve the previous
fix as suggested by Martin.
2003-09-29 Paolo Carlini <pcarlini@unitus.it>
PR libstdc++/12296

View File

@ -609,7 +609,8 @@ namespace std
else {
__first = std::find(__first, __last, __val);
while (__first != __last) {
typename iterator_traits<_ForwardIterator>::difference_type __n = __count - 1;
typename iterator_traits<_ForwardIterator>::difference_type __n = __count;
--__n;
_ForwardIterator __i = __first;
++__i;
while (__i != __last && __n != 0 && *__i == __val) {
@ -661,7 +662,8 @@ namespace std
++__first;
}
while (__first != __last) {
typename iterator_traits<_ForwardIterator>::difference_type __n = __count - 1;
typename iterator_traits<_ForwardIterator>::difference_type __n = __count;
--__n;
_ForwardIterator __i = __first;
++__i;
while (__i != __last && __n != 0 && __binary_pred(*__i, __val)) {