From 1ec30620efa20b977117da143f4816bdbc089197 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Wed, 28 Jan 2026 19:43:57 -0800 Subject: [PATCH] Refactor optimization and model to use C++17 structured bindings for pairs (#8426) * Initial plan * Refactor pairs to use C++17 structured bindings in opt and model components Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com> --- src/model/model_core.cpp | 3 ++- src/opt/opt_context.cpp | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/model/model_core.cpp b/src/model/model_core.cpp index e8d6e91f2..887f6c634 100644 --- a/src/model/model_core.cpp +++ b/src/model/model_core.cpp @@ -22,7 +22,8 @@ Revision History: model_core::~model_core() { for (auto & kv : m_interp) { m.dec_ref(kv.m_key); - m.dec_ref(kv.m_value.second); + auto [idx, e] = kv.m_value; + m.dec_ref(e); } for (auto & kv : m_finterp) { diff --git a/src/opt/opt_context.cpp b/src/opt/opt_context.cpp index e843c92bd..8bfef7f24 100644 --- a/src/opt/opt_context.cpp +++ b/src/opt/opt_context.cpp @@ -744,11 +744,12 @@ namespace opt { for (unsigned i = 0; i < m_objectives.size(); ++i) { objective const& obj = m_objectives[i]; display_objective(out, obj); + auto [lower, upper] = b[i]; if (obj.m_type == O_MAXIMIZE) { - out << " |-> [" << b[i].first << ":" << b[i].second << "]\n"; + out << " |-> [" << lower << ":" << upper << "]\n"; } else { - out << " |-> [" << -b[i].second << ":" << -b[i].first << "]\n"; + out << " |-> [" << -upper << ":" << -lower << "]\n"; } } }