add begin of c++ version