Dymsza
Dymsza

Reputation: 9

knuth morris pratt + boost + circular_buffer

I found that Boost implements KMP algorithm and I was tring to use it with circular_buffer but I couldn't match this to components. Can anyone experience with boost show me how to do this.

Upvotes: 0

Views: 427

Answers (1)

Marshall Clow
Marshall Clow

Reputation: 16700

What kind of problems were you having?

#include <boost/circular_buffer.hpp>
#include <boost/algorithm/searching/knuth_morris_pratt.hpp>
#include <string>

int main (int, char **) {
    boost::circular_buffer<char> cb;
    std::string s;
    boost::algorithm::knuth_morris_pratt_search ( cb.begin (), cb.end (), s.begin (), s.end ());
}

Upvotes: 2

Related Questions