A C++ version of it.