Guest User

Untitled

a guest
Apr 3rd, 2021
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.81 KB | None | 0 0
  1. else if (is_binary_op(std::get<std::string>(tok)))
  2.             {
  3.                 auto right = stack.top();
  4.                 stack.pop();
  5.                 if (!stack.empty())
  6.                 {
  7.                     auto left = stack.top();
  8.                     stack.pop();
  9.                     auto op = std::get<std::string>(tok);
  10.                     stack.push([left, right, op](double var_value) {return compute_binary_ops(left(var_value), right(var_value), op);});
  11.                 }
  12.                 else if(std::get<std::string>(tok) == "-")
  13.                 {
  14.                     stack.push([right](double var_value) {return -(right(var_value));});
  15.                 }
  16.                 else
  17.                 {
  18.                     throw parse_error("error in build func");
  19.                 }                
  20.             }
Advertisement
Add Comment
Please, Sign In to add comment