]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
stl_algo.h (search(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardI...
authorJim Xochellis <jimxoch@yahoo.gr>
Thu, 5 Jul 2007 00:50:56 +0000 (03:50 +0300)
committerPaolo Carlini <paolo@gcc.gnu.org>
Thu, 5 Jul 2007 00:50:56 +0000 (00:50 +0000)
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

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/stl_algo.h

index e467b5e62554758ba31e278c2984bb8eba2ee6e7..8b8af166959d62381b1dbaa8f08717759ff06bcb 100644 (file)
@@ -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
index 96b6602f5871c4be99d5b09f57775a6986ce1079..2befdb2bfcd5e8b74d02c950461ca9bc7258ba94 100644 (file)
@@ -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;