Commit 6821a40b by Paolo Carlini Committed by Paolo Carlini

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
parent 3ec278de
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
* include/bits/istream.tcc (peek): Set eofbit if sgetc
returns eof.
......
......@@ -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)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment