translated all remaining ruby to C++