Knuth Morris Pratt algorithm from the Boost's algorithm library
Added simpler C++ API
Compiled to JavaScript with Cheerp
- Download and install cheerp
- Download Boost libs - https://www.boost.org/users/download/
- Extract "Boost folder" to cheerp's include location
C:\cheerp\include
on Windows/opt/cheerp/include
on Linux/MacOS
- Extract "Boost folder" to cheerp's include location
- Run cheerp on
KnuthMorrisPratt.cpp
C:\cheerp\bin\clang++ -target cheerp .\KnuthMorrisPratt.cpp -O3 -o kmp.js
on Windows/opt/cheerp/bin/clang++ -target cheerp .\KnuthMorrisPratt.cpp -O3 -o kmp.js
on Linux.MacOS
- ES6
C:\cheerp\bin\clang++ -target cheerp .\KnuthMorrisPratt.cpp -O3 -o kmp.js -cheerp-make-module=es6
- CJS
C:\cheerp\bin\clang++ -target cheerp .\KnuthMorrisPratt.cpp -O3 -o kmp.js -cheerp-make-module=commonjs
- Closure wrap
C:\cheerp\bin\clang++ -target cheerp .\KnuthMorrisPratt.cpp -O3 -o kmp.js -cheerp-make-module=commonjs
To understand how to use the module read here
Note see the cheerp documentation for more options