diff options
author | Jim Xochellis <jimxoch@yahoo.gr> | 2007-07-09 12:00:34 +0300 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2007-07-09 09:00:34 +0000 |
commit | 58b9f26a61eb587028067093cd903f7e830b48ba (patch) | |
tree | 00b64ba3c077ca2bfac328c54d450e8b9b3a8e9d /libstdc++-v3 | |
parent | 57728874d2a68f3918a2e44c65c6ae100e34eaf6 (diff) | |
download | gcc-58b9f26a61eb587028067093cd903f7e830b48ba.zip gcc-58b9f26a61eb587028067093cd903f7e830b48ba.tar.gz gcc-58b9f26a61eb587028067093cd903f7e830b48ba.tar.bz2 |
stl_algo.h (search(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2)): Tidy.
2007-07-09 Jim Xochellis <jimxoch@yahoo.gr>
Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_algo.h (search(_ForwardIterator1,
_ForwardIterator1, _ForwardIterator2, _ForwardIterator2)): Tidy.
(search(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2,
_ForwardIterator2, _BinaryPredicate)): Likewise.
Co-Authored-By: Paolo Carlini <pcarlini@suse.de>
From-SVN: r126479
Diffstat (limited to 'libstdc++-v3')
-rw-r--r-- | libstdc++-v3/ChangeLog | 8 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/stl_algo.h | 17 |
2 files changed, 15 insertions, 10 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 311d1e1..0c38956 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,11 @@ +2007-07-09 Jim Xochellis <jimxoch@yahoo.gr> + Paolo Carlini <pcarlini@suse.de> + + * include/bits/stl_algo.h (search(_ForwardIterator1, + _ForwardIterator1, _ForwardIterator2, _ForwardIterator2)): Tidy. + (search(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, + _ForwardIterator2, _BinaryPredicate)): Likewise. + 2007-07-06 Hans-Peter Nilsson <hp@axis.com> * testsuite/lib/libstdc++.exp (v3-build_support): Use env(AR) diff --git a/libstdc++-v3/include/bits/stl_algo.h b/libstdc++-v3/include/bits/stl_algo.h index 2befdb2b..160dc2f 100644 --- a/libstdc++-v3/include/bits/stl_algo.h +++ b/libstdc++-v3/include/bits/stl_algo.h @@ -624,19 +624,18 @@ _GLIBCXX_BEGIN_NAMESPACE(std) typename iterator_traits<_ForwardIterator2>::value_type>) __glibcxx_requires_valid_range(__first1, __last1); __glibcxx_requires_valid_range(__first2, __last2); + // Test for empty ranges if (__first1 == __last1 || __first2 == __last2) return __first1; // Test for a pattern of length 1. - _ForwardIterator2 __tmp(__first2); - ++__tmp; - if (__tmp == __last2) + _ForwardIterator2 __p1(__first2); + if (++__p1 == __last2) return std::find(__first1, __last1, *__first2); // General case. - _ForwardIterator2 __p1, __p; - __p1 = __first2; ++__p1; + _ForwardIterator2 __p; _ForwardIterator1 __current = __first1; for (;;) @@ -703,9 +702,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) return __first1; // Test for a pattern of length 1. - _ForwardIterator2 __tmp(__first2); - ++__tmp; - if (__tmp == __last2) + _ForwardIterator2 __p1(__first2); + if (++__p1 == __last2) { while (__first1 != __last1 && !bool(__predicate(*__first1, *__first2))) @@ -714,8 +712,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) } // General case. - _ForwardIterator2 __p1, __p; - __p1 = __first2; ++__p1; + _ForwardIterator2 __p; _ForwardIterator1 __current = __first1; for (;;) |