January 2019
Intermediate to advanced
384 pages
11h 50m
English
When your performance is dominated by searching for substrings, then the good news is that C++17 adds an implementation of the Boyer-More-Horspool string-searching algorithm, which is often faster than the standard STL search. This algorithm doesn't check every character of a string, but rather tries to skip over some of them using a table generated from the string searched for (that is, the needle). Look at the following example for its usage:
QString text = "Lorem ipsum dolor sit amet, consectetur adipiscing ...";QString needle ="amet";auto iter = std::search(text.constBegin(), text.constEnd(), std::boyer_moore_searcher( needle.constBegin(), needle.constEnd()));
In C++11, we can use Boost implementation of the Boyer-More-Horspool ...
Read now
Unlock full access