Dmitry Olshansky:
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.
OK.
Regarding the license, this is a translation from another
language of a basic algorithm. I don't think the original license
applies.
And if it applies, the author is Eppstein
(http://en.wikipedia.org/wiki/David_Eppstein ) that I know well.
For a translation of such small amount of code he will probably
accept a Boost re-licensing :-)
Bye,
bearophile