cpp implementation of evaluate_reverse_polish_notation