Add C++ implementation