Convert hcmplx.c to C++