|
From: | Ivan Godard |
Subject: | Bug report |
Date: | Wed, 24 Sep 2003 10:58:25 -0700 |
In the library that came with gcc3.3.1, file
bits/stl_algo.h, function "search" (version taking a predicate function in
addition to iterators):
The second nested while loop in the general case
(line 562 in my version) is identical in effect to the first loop immediately
before and is redundant. However, a compiler is unlikely to detect that the
second loop will never execute.
Both while loops and the following exit test can be
combined (for better code) to:
while(true) {
if (__first1 ==
__last1)
return
__last1;
if (__predicate(*__first1,
*__first2))
break;
++__first1;
}
Ivan
|
[Prev in Thread] | Current Thread | [Next in Thread] |