Lazy KMP range

Dmitry Olshansky dmitry.olsh at gmail.com
Fri Jun 15 12:17:10 PDT 2012


On 15.06.2012 23:03, bearophile wrote:
> A lazy Knuth-Morris-Pratt that works on a Input Range:
> http://ideone.com/dUs5B
>
> Do you have suggestions for improvements of the code? Maybe do I have to
> turn it into a Forward Range if the first range is a Forward one? Is
> something similar to this useful for Phobos?
>

Yes, definitely just decouple table preparation and searching range 
itself.  It's common to use KMP and its ilk to do a lot of series of 
searches for the same needle.

> Bye and thank you,
> bearophile


-- 
Dmitry Olshansky


More information about the Digitalmars-d-learn mailing list