mirror of
https://github.com/Z3Prover/z3
synced 2026-02-10 02:50:55 +00:00
Migrate iterator-based for loops to range-based for loops (#8231)
* Initial plan * Migrate iterator-based for loops to range-based for loops in 11 files Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com> * Fix compilation error in aig_exporter.cpp - use correct iterator API Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com> * Revert changes to z3++.h as requested 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:
parent
58d3c29c9c
commit
eddb75b2e7
8 changed files with 33 additions and 57 deletions
|
|
@ -238,9 +238,8 @@ bv_bounds::conv_res bv_bounds::convert(expr * e, vector<ninterval>& nis, bool ne
|
|||
}
|
||||
|
||||
void bv_bounds::reset() {
|
||||
intervals_map::iterator it = m_negative_intervals.begin();
|
||||
const intervals_map::iterator end = m_negative_intervals.end();
|
||||
for (; it != end; ++it) dealloc(it->m_value);
|
||||
for (auto& [key, value] : m_negative_intervals)
|
||||
dealloc(value);
|
||||
}
|
||||
|
||||
br_status bv_bounds::rewrite(unsigned limit, func_decl * f, unsigned num, expr * const * args, expr_ref& result) {
|
||||
|
|
@ -312,9 +311,7 @@ br_status bv_bounds::rewrite(unsigned limit, func_decl * f, unsigned num, expr *
|
|||
if (nargs.size() == num && !has_singls) return BR_FAILED;
|
||||
|
||||
expr_ref eq(m_m);
|
||||
for (bv_bounds::bound_map::iterator i = m_singletons.begin(); i != m_singletons.end(); ++i) {
|
||||
app * const v = i->m_key;
|
||||
const rational val = i->m_value;
|
||||
for (auto& [v, val] : m_singletons) {
|
||||
eq = m_m.mk_eq(v, bvu().mk_numeral(val, v->get_decl()->get_range()));
|
||||
if (negated) eq = m_m.mk_not(eq);
|
||||
nargs.push_back(eq);
|
||||
|
|
@ -568,20 +565,17 @@ bool bv_bounds::is_sat() {
|
|||
obj_hashtable<app> seen;
|
||||
obj_hashtable<app>::entry *dummy;
|
||||
|
||||
for (bound_map::iterator i = m_unsigned_lowers.begin(); i != m_unsigned_lowers.end(); ++i) {
|
||||
app * const v = i->m_key;
|
||||
for (auto& [v, _] : m_unsigned_lowers) {
|
||||
if (!seen.insert_if_not_there_core(v, dummy)) continue;
|
||||
if (!is_sat(v)) return false;
|
||||
}
|
||||
|
||||
for (bound_map::iterator i = m_unsigned_uppers.begin(); i != m_unsigned_uppers.end(); ++i) {
|
||||
app * const v = i->m_key;
|
||||
for (auto& [v, _] : m_unsigned_uppers) {
|
||||
if (!seen.insert_if_not_there_core(v, dummy)) continue;
|
||||
if (!is_sat(v)) return false;
|
||||
}
|
||||
|
||||
for (intervals_map::iterator i = m_negative_intervals.begin(); i != m_negative_intervals.end(); ++i) {
|
||||
app * const v = i->m_key;
|
||||
for (auto& [v, _] : m_negative_intervals) {
|
||||
if (!seen.insert_if_not_there_core(v, dummy)) continue;
|
||||
if (!is_sat(v)) return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue