From 9796bdbfee1d60f309704003872a71abcd1c4538 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Chocholat=C3=BD?= Date: Fri, 8 Sep 2023 13:48:32 +0200 Subject: [PATCH] Refactor to never push to front --- include/mata/parser/inter-aut.hh | 2 +- src/inter-aut.cc | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/mata/parser/inter-aut.hh b/include/mata/parser/inter-aut.hh index f1e9b3b0..f9635de8 100644 --- a/include/mata/parser/inter-aut.hh +++ b/include/mata/parser/inter-aut.hh @@ -123,7 +123,7 @@ public: */ struct FormulaGraph { FormulaNode node{}; - std::deque children{}; + std::vector children{}; FormulaGraph() = default; FormulaGraph(const FormulaNode& n) : node(n), children() {} diff --git a/src/inter-aut.cc b/src/inter-aut.cc index c4bf3998..e028cbd4 100644 --- a/src/inter-aut.cc +++ b/src/inter-aut.cc @@ -279,10 +279,12 @@ namespace { break; default: assert(opstack.size() > 1); - gr.children.emplace_back(std::move(opstack.back())); + mata::FormulaGraph second_child{ std::move(opstack.back()) }; opstack.pop_back(); - gr.children.emplace_front(std::move(opstack.back())); + mata::FormulaGraph first_child{ std::move(opstack.back()) }; opstack.pop_back(); + gr.children.emplace_back(std::move(first_child)); + gr.children.emplace_back(std::move(second_child)); opstack.emplace_back(std::move(gr)); } break;