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]

find_end() optimization for random access iterators.


Hello,
	A few months ago, there was a discussion about using <algorithm>
 functions in the std::basic_string<> implementation, and std::search wa
used to implement find(). However, the std::find_end() does not have a
specialization for random-access iterators, and thus using it to
implement rfind() would be unwise. Hence, I have proposed a patch to
include a specialization for std::find_end() for random access
iterators. The timings look good compared to th existing rfind() timings
for a certain test-case. (1.7s compared to 5.64s), so if nobody thinks
it's a particularly bad idea, I would like to suggest:

1. This algorithm be added to <algorithm> (actually, stl_algo.h)
2. basic_string<>::rfind() use find_end for implementing the
functionality.

-- 
        -Dhruv Matani.
http://www.geocities.com/dhruvbird/

The price of freedom is responsibility, but it's a bargain, because
freedom is priceless. ~ Hugh Downs


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