How about writing a c++ version firstly?