Boost logo

Boost :

Subject: [boost] [String Algo] Any reason the predicates don't optimize for random access iterators?
From: Nevin Liber (nevin_at_[hidden])
Date: 2015-11-03 16:28:32

I was looking in boost/algorithm/string/predicate.hpp and noticed that that
the predicates *starts_with, *ends_with, *contains and *equals don't
optimize for random access iterators.

While I haven't done any benchmarks yet, it seems like it would be faster
for random access iterators to do an O(1) length check at the beginning and
then while looping only check one iterator against its end instead of two.

 Nevin :-)

 Nevin ":-)" Liber  <mailto:nevin_at_c <nevin_at_[hidden]>>
(847) 691-1404

Boost list run by bdawes at, gregod at, cpdaniel at, john at