3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-02-08 18:19:40 +00:00

Adopt C++17 structured bindings for map/pair iteration (#8159)

* Initial plan

* Adopt structured bindings for map iteration

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>

* Fix DEBUG_CODE macro issue with structured bindings

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-11 17:44:12 -08:00 committed by GitHub
parent 9a80bd2016
commit 31122b0c10
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 20 additions and 23 deletions

View file

@ -1504,7 +1504,7 @@ namespace lp {
variable_values[j] = get_value(j);
TRACE(lar_solver_model, tout << "delta = " << m_imp->m_delta << "\nmodel:\n";
for (auto p : variable_values) tout << this->get_variable_name(p.first) << " = " << p.second << "\n";);
for (auto [var_idx, val] : variable_values) tout << this->get_variable_name(var_idx) << " = " << val << "\n";);
}
bool lar_solver::init_model() const {

View file

@ -425,17 +425,17 @@ void nex_creator::sort_join_sum(nex_sum& sum) {
rational common_scalar(0);
fill_join_map_for_sum(sum, map, allocated_nexs, common_scalar);
TRACE(grobner_d, for (auto & p : map ) { tout << "(" << *p.first << ", " << p.second << ") ";});
TRACE(grobner_d, for (auto & [nex_ptr, coeff] : map ) { tout << "(" << *nex_ptr << ", " << coeff << ") ";});
sum.m_children.reset();
for (auto& p : map) {
process_map_pair(const_cast<nex*>(p.first), p.second, sum, allocated_nexs);
for (auto& [nex_ptr, coeff] : map) {
process_map_pair(const_cast<nex*>(nex_ptr), coeff, sum, allocated_nexs);
}
if (!common_scalar.is_zero()) {
sum.m_children.push_back(mk_scalar(common_scalar));
}
TRACE(grobner_d,
tout << "map=";
for (auto & p : map ) tout << "(" << *p.first << ", " << p.second << ") ";
for (auto & [nex_ptr, coeff] : map ) tout << "(" << *nex_ptr << ", " << coeff << ") ";
tout << "\nchildren=" << sum << "\n";);
}