add a c++ version