converting rgc_test to c++