diff options
author | Jim Xochellis <jimxoch@yahoo.gr> | 2007-07-05 03:50:56 +0300 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2007-07-05 00:50:56 +0000 |
commit | e5e941450f9c08cb0b02c63ff172e970104f3b0d (patch) | |
tree | 9b545576b994a53eb74dd386b672b34929345b01 /libstdc++-v3 | |
parent | e9a57dc16c467bf3d7b146d8fdef434269c77da5 (diff) | |
download | gcc-e5e941450f9c08cb0b02c63ff172e970104f3b0d.zip gcc-e5e941450f9c08cb0b02c63ff172e970104f3b0d.tar.gz gcc-e5e941450f9c08cb0b02c63ff172e970104f3b0d.tar.bz2 |
stl_algo.h (search(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2)): Simplify general case loop to a for(;;).
2007-07-04 Jim Xochellis <jimxoch@yahoo.gr>
* include/bits/stl_algo.h (search(_ForwardIterator1,
_ForwardIterator1, _ForwardIterator2, _ForwardIterator2)): Simplify
general case loop to a for(;;).
(search(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2,
_ForwardIterator2, _BinaryPredicate)): Likewise; remove redundant
inner loop.
From-SVN: r126347
Diffstat (limited to 'libstdc++-v3')
-rw-r--r-- | libstdc++-v3/ChangeLog | 9 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/stl_algo.h | 14 |
2 files changed, 13 insertions, 10 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index e467b5e..8b8af16 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,12 @@ +2007-07-04 Jim Xochellis <jimxoch@yahoo.gr> + + * include/bits/stl_algo.h (search(_ForwardIterator1, + _ForwardIterator1, _ForwardIterator2, _ForwardIterator2)): Simplify + general case loop to a for(;;). + (search(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, + _ForwardIterator2, _BinaryPredicate)): Likewise; remove redundant + inner loop. + 2007-07-03 Paolo Carlini <pcarlini@suse.de> PR libstdc++/31518 diff --git a/libstdc++-v3/include/bits/stl_algo.h b/libstdc++-v3/include/bits/stl_algo.h index 96b6602..2befdb2b 100644 --- a/libstdc++-v3/include/bits/stl_algo.h +++ b/libstdc++-v3/include/bits/stl_algo.h @@ -639,7 +639,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) __p1 = __first2; ++__p1; _ForwardIterator1 __current = __first1; - while (__first1 != __last1) + for (;;) { __first1 = std::find(__first1, __last1, *__first2); if (__first1 == __last1) @@ -718,16 +718,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std) __p1 = __first2; ++__p1; _ForwardIterator1 __current = __first1; - while (__first1 != __last1) + for (;;) { - while (__first1 != __last1) - { - if (__predicate(*__first1, *__first2)) - break; - ++__first1; - } - while (__first1 != __last1 && - !bool(__predicate(*__first1, *__first2))) + while (__first1 != __last1 + && !bool(__predicate(*__first1, *__first2))) ++__first1; if (__first1 == __last1) return __last1; |