A better solution to make it compile under cpp