This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Is std::search coding fast enough?


On 04/07/07, Dimitris Xochellis <jimxoch@yahoo.gr> wrote:
Hi list,

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.


For a while I was worried that this code was wrong, I think the
"general case" wouldn't work for a search string of length 1, although
that doesn't matter as we special case that.

Chris


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]