add cpp implementation
Merge pull request #435 from jacket-code/master

add cpp implementation