Converted reflection code from c style to c++