add cpp implementation