This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Is std::search coding fast enough?
- From: Paolo Carlini <pcarlini at suse dot de>
- To: Dimitris Xochellis <jimxoch at yahoo dot gr>
- Cc: libstdc++ at gcc dot gnu dot org
- Date: Wed, 04 Jul 2007 18:46:21 +0200
- Subject: Re: Is std::search coding fast enough?
- References: <473168.32327.qm@web23103.mail.ird.yahoo.com>
Dimitris Xochellis wrote:
Hi list,
Hi poster ;)
After reading the following std::search STL algorithm [1] I have got the impression that it can be
coded in a more efficient way. In my opinion, the code in the lines *A* & *C* guaranties that the
condition of the line *B* will be always true. Consequently, we can effectively replace the "while
(__first1 != __last1)" expression of the line *B* with a simpler "for ( ; ; )" expression and the
algorithm will work just fine and significantly faster as well.
I agree. I would say the same is true for the std::search taking a
predicate, right?
Paolo.