C++ version of infer_logx