Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- else if (is_binary_op(std::get<std::string>(tok)))
- {
- auto right = stack.top();
- stack.pop();
- if (!stack.empty())
- {
- auto left = stack.top();
- stack.pop();
- auto op = std::get<std::string>(tok);
- stack.push([left, right, op](double var_value) {return compute_binary_ops(left(var_value), right(var_value), op);});
- }
- else if(std::get<std::string>(tok) == "-")
- {
- stack.push([right](double var_value) {return -(right(var_value));});
- }
- else
- {
- throw parse_error("error in build func");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment