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?


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.


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