From 67d01417b7c3092d7333702971da357b9d3c4e33 Mon Sep 17 00:00:00 2001 From: myerspat Date: Wed, 27 Jul 2022 11:18:02 -0500 Subject: [PATCH] Fixed errors due to iterators --- src/cell.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cell.cpp b/src/cell.cpp index 578fb024da..edd4da84d9 100644 --- a/src/cell.cpp +++ b/src/cell.cpp @@ -700,7 +700,7 @@ void CSGCell::remove_complement_ops(vector& infix) // Define stop given left parenthesis or not auto stop = it; if (*it == OP_LEFT_PAREN) { - stop = std::find(infix.begin(), infix.end(), OP_RIGHT_PAREN); + stop = std::find(it, infix.end(), OP_RIGHT_PAREN); it++; } @@ -708,7 +708,7 @@ void CSGCell::remove_complement_ops(vector& infix) // positions in the RPN apply_demorgan(it, stop); // update iterator position - it = std::find(infix.begin(), infix.end(), OP_COMPLEMENT); + it = std::find(it, infix.end(), OP_COMPLEMENT); } } @@ -801,7 +801,7 @@ bool CSGCell::contains_complex( // the next right parenthesis, if the token is a right // parenthesis leave short circuiting if (next_token == OP_LEFT_PAREN) { - it = std::find(it, rpn_.end(), OP_RIGHT_PAREN); + it = std::find(it, rpn_.end() - 1, OP_RIGHT_PAREN); } else if (next_token == OP_RIGHT_PAREN) { break; }