diff --git a/src/inter-aut.cc b/src/inter-aut.cc index ca144344c..d860d85c0 100644 --- a/src/inter-aut.cc +++ b/src/inter-aut.cc @@ -206,8 +206,8 @@ bool has_atmost_one_auto_naming(const mata::IntermediateAut& aut) { * @param tokens Series of tokens representing transition formula parsed from the input text * @return A postfix notation for input */ - std::vector infix_to_postfix( - const mata::IntermediateAut &aut, const std::vector& tokens) { + std::vector infix_to_postfix(const mata::IntermediateAut &aut, + const std::vector& tokens) { std::vector opstack; std::vector output; @@ -229,13 +229,14 @@ bool has_atmost_one_auto_naming(const mata::IntermediateAut& aut) { break; case mata::FormulaNode::Type::OPERATOR: for (int j = static_cast(opstack.size())-1; j >= 0; --j) { - size_t j_size_t{ static_cast(j) }; - assert(!opstack[j_size_t].is_operand()); - if (opstack[j_size_t].is_leftpar()) + auto formula_node_opstack_it{ opstack.begin() + j }; + assert(!formula_node_opstack_it->is_operand()); + if (formula_node_opstack_it->is_leftpar()) { break; - if (lower_precedence(node.operator_type, opstack[j_size_t].operator_type)) { - output.emplace_back(std::move(opstack[j_size_t])); - opstack.erase(opstack.begin()+j); + } + if (lower_precedence(node.operator_type, formula_node_opstack_it->operator_type)) { + output.emplace_back(std::move(*formula_node_opstack_it)); + opstack.erase(formula_node_opstack_it); } } opstack.emplace_back(std::move(node));