mirror of
https://github.com/Z3Prover/z3
synced 2026-02-19 15:04:42 +00:00
Modernize C++ patterns: range-based for loops and nullptr (#8167)
* Initial plan * Replace NULL with nullptr in test files Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com> * Convert iterator loops to range-based for loops (part 1) Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com> * Convert iterator loops to range-based for loops (part 2) Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com> * Fix compilation errors in iterator loop conversions 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
15108bf36e
commit
b5492e5cf9
16 changed files with 84 additions and 140 deletions
|
|
@ -937,18 +937,11 @@ namespace datalog {
|
|||
unsigned t1first_func = t1.get_signature().first_functional();
|
||||
unsigned t2first_func = t2.get_signature().first_functional();
|
||||
|
||||
table_base::iterator els1it = t1.begin();
|
||||
table_base::iterator els1end = t1.end();
|
||||
table_base::iterator els2end = t2.end();
|
||||
|
||||
table_fact acc;
|
||||
|
||||
for(; els1it!=els1end; ++els1it) {
|
||||
const table_base::row_interface & row1 = *els1it;
|
||||
for (const table_base::row_interface& row1 : t1) {
|
||||
|
||||
table_base::iterator els2it = t2.begin();
|
||||
for(; els2it!=els2end; ++els2it) {
|
||||
const table_base::row_interface & row2 = *els2it;
|
||||
for (const table_base::row_interface& row2 : t2) {
|
||||
|
||||
bool match=true;
|
||||
for(unsigned i=0; i<m_col_cnt; i++) {
|
||||
|
|
@ -1491,10 +1484,7 @@ namespace datalog {
|
|||
|
||||
bool should_remove(const table_fact & f) const override {
|
||||
if(!m_all_neg_bound || m_overlap) {
|
||||
table_base::iterator nit = m_negated_table->begin();
|
||||
table_base::iterator nend = m_negated_table->end();
|
||||
for(; nit!=nend; ++nit) {
|
||||
const table_base::row_interface & nrow = *nit;
|
||||
for (const table_base::row_interface& nrow : *m_negated_table) {
|
||||
if(bindings_match(nrow, f)) {
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1656,13 +1646,13 @@ namespace datalog {
|
|||
f.resize(m_result_col_cnt);
|
||||
}
|
||||
|
||||
void mk_project(table_base::iterator& it) {
|
||||
void mk_project(const table_base::row_interface& row) {
|
||||
for (unsigned i = 0, j = 0, r_i = 0; i < m_inp_col_cnt; ++i) {
|
||||
if (r_i < m_removed_col_cnt && m_removed_cols[r_i] == i) {
|
||||
++r_i;
|
||||
}
|
||||
else {
|
||||
m_row[j] = m_former_row[j] = (*it)[i];
|
||||
m_row[j] = m_former_row[j] = row[i];
|
||||
++j;
|
||||
}
|
||||
}
|
||||
|
|
@ -1674,9 +1664,8 @@ namespace datalog {
|
|||
SASSERT(plugin.can_handle_signature(res_sign));
|
||||
table_base * res = plugin.mk_empty(res_sign);
|
||||
|
||||
table_base::iterator it = t.begin(), end = t.end();
|
||||
for (; it != end; ++it) {
|
||||
mk_project(it);
|
||||
for (const table_base::row_interface& row : t) {
|
||||
mk_project(row);
|
||||
if (!res->suggest_fact(m_former_row)) {
|
||||
(*m_reducer)(m_former_row.data()+m_res_first_functional, m_row.data()+m_res_first_functional);
|
||||
res->ensure_fact(m_former_row);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue