This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
find_end() optimization for random access iterators.
- From: Dhruv Matani <dhruvbird at gmx dot net>
- To: libstdc++ <libstdc++ at gcc dot gnu dot org>
- Date: 14 Dec 2004 21:20:22 +0530
- Subject: find_end() optimization for random access iterators.
- Organization:
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