3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-01-29 21:38:44 +00:00

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>
This commit is contained in:
Copilot 2026-01-28 19:43:57 -08:00 committed by GitHub
parent 0b1d30e86f
commit 1ec30620ef
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 3 deletions

View file

@ -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) {

View file

@ -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";
}
}
}