convert C++ code to D