Refine evaluation and deal with compiler errors in c++