Skip to content

Commit 499ed5d

Browse files
committed
remove unneeded iterator functions
1 parent 737c220 commit 499ed5d

32 files changed

+26
-86
lines changed

src/ast/euf/euf_ac_plugin.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@ namespace euf {
6161
node* operator*() { return m_first; }
6262
iterator& operator++() { if (!m_last) m_last = m_first; m_first = m_first->next; return *this; }
6363
iterator operator++(int) { iterator tmp = *this; ++*this; return tmp; }
64-
bool operator==(iterator const& other) const { return m_last == other.m_last && m_first == other.m_first; }
65-
bool operator!=(iterator const& other) const { return !(*this == other); }
64+
bool operator!=(iterator const& other) const { return m_last != other.m_last || m_first != other.m_first; }
6665
};
6766
equiv(node& _n) :n(_n) {}
6867
equiv(node* _n) :n(*_n) {}

src/ast/euf/euf_enode.h

+2-4
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,7 @@ namespace euf {
280280
enode* operator*() { return m_first; }
281281
iterator& operator++() { if (!m_last) m_last = m_first; m_first = m_first->m_next; return *this; }
282282
iterator operator++(int) { iterator tmp = *this; ++*this; return tmp; }
283-
bool operator==(iterator const& other) const { return m_last == other.m_last && m_first == other.m_first; }
284-
bool operator!=(iterator const& other) const { return !(*this == other); }
283+
bool operator!=(iterator const& other) const { return m_last != other.m_last || m_first != other.m_first; }
285284
};
286285
enode_class(enode & _n):n(_n) {}
287286
enode_class(enode * _n):n(*_n) {}
@@ -300,8 +299,7 @@ namespace euf {
300299
th_var_list const& operator*() { return *m_th_vars; }
301300
iterator& operator++() { m_th_vars = m_th_vars->get_next(); return *this; }
302301
iterator operator++(int) { iterator tmp = *this; ++* this; return tmp; }
303-
bool operator==(iterator const& other) const { return m_th_vars == other.m_th_vars; }
304-
bool operator!=(iterator const& other) const { return !(*this == other); }
302+
bool operator!=(iterator const& other) const { return m_th_vars != other.m_th_vars; }
305303
};
306304
enode_th_vars(enode& _n) :n(_n) {}
307305
enode_th_vars(enode* _n) :n(*_n) {}

src/ast/for_each_expr.cpp

+8-16
Original file line numberDiff line numberDiff line change
@@ -146,20 +146,16 @@ subterms::iterator& subterms::iterator::operator++() {
146146
return *this;
147147
}
148148

149-
bool subterms::iterator::operator==(iterator const& other) const {
149+
bool subterms::iterator::operator!=(iterator const& other) const {
150150
// ignore state of visited
151151
if (other.m_esp->size() != m_esp->size()) {
152-
return false;
152+
return true;
153153
}
154154
for (unsigned i = m_esp->size(); i-- > 0; ) {
155155
if (m_esp->get(i) != other.m_esp->get(i))
156-
return false;
156+
return true;
157157
}
158-
return true;
159-
}
160-
161-
bool subterms::iterator::operator!=(iterator const& other) const {
162-
return !(*this == other);
158+
return false;
163159
}
164160

165161

@@ -216,18 +212,14 @@ subterms_postorder::iterator& subterms_postorder::iterator::operator++() {
216212
return *this;
217213
}
218214

219-
bool subterms_postorder::iterator::operator==(iterator const& other) const {
215+
bool subterms_postorder::iterator::operator!=(iterator const& other) const {
220216
// ignore state of visited
221217
if (other.m_es.size() != m_es.size()) {
222-
return false;
218+
return true;
223219
}
224220
for (unsigned i = m_es.size(); i-- > 0; ) {
225221
if (m_es.get(i) != other.m_es.get(i))
226-
return false;
222+
return true;
227223
}
228-
return true;
229-
}
230-
231-
bool subterms_postorder::iterator::operator!=(iterator const& other) const {
232-
return !(*this == other);
224+
return false;
233225
}

src/ast/for_each_expr.h

-2
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,6 @@ class subterms {
190190
expr* operator*();
191191
iterator operator++(int);
192192
iterator& operator++();
193-
bool operator==(iterator const& other) const;
194193
bool operator!=(iterator const& other) const;
195194
};
196195

@@ -220,7 +219,6 @@ class subterms_postorder {
220219
expr* operator*();
221220
iterator operator++(int);
222221
iterator& operator++();
223-
bool operator==(iterator const& other) const;
224222
bool operator!=(iterator const& other) const;
225223
};
226224
static subterms_postorder all(expr_ref_vector const& es) { return subterms_postorder(es, true); }

src/math/dd/dd_pdd.h

+1-3
Original file line numberDiff line numberDiff line change
@@ -571,8 +571,7 @@ namespace dd {
571571
pdd_monomial const* operator->() const { return &m_mono; }
572572
pdd_iterator& operator++() { next(); return *this; }
573573
pdd_iterator operator++(int) { auto tmp = *this; next(); return tmp; }
574-
bool operator==(pdd_iterator const& other) const { return m_nodes == other.m_nodes; }
575-
bool operator!=(pdd_iterator const& other) const { return !operator==(other); }
574+
bool operator!=(pdd_iterator const& other) const { return m_nodes != other.m_nodes; }
576575
};
577576

578577
class pdd_linear_iterator {
@@ -591,7 +590,6 @@ namespace dd {
591590
pointer operator->() const { return &m_mono; }
592591
pdd_linear_iterator& operator++() { next(); return *this; }
593592
pdd_linear_iterator operator++(int) { auto tmp = *this; next(); return tmp; }
594-
bool operator==(pdd_linear_iterator const& other) const { return m_next == other.m_next; }
595593
bool operator!=(pdd_linear_iterator const& other) const { return m_next != other.m_next; }
596594
};
597595

src/math/hilbert/heap_trie.h

-1
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,6 @@ class heap_trie {
369369
}
370370
iterator& operator++() { fwd(); return *this; }
371371
iterator operator++(int) { iterator tmp = *this; ++*this; return tmp; }
372-
bool operator==(iterator const& it) const {return m_count == it.m_count; }
373372
bool operator!=(iterator const& it) const {return m_count != it.m_count; }
374373

375374
private:

src/math/hilbert/hilbert_basis.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,6 @@ class hilbert_basis::passive {
455455
offset_t operator*() const { return p.m_passive[m_idx]; }
456456
iterator& operator++() { ++m_idx; fwd(); return *this; }
457457
iterator operator++(int) { iterator tmp = *this; ++*this; return tmp; }
458-
bool operator==(iterator const& it) const {return m_idx == it.m_idx; }
459458
bool operator!=(iterator const& it) const {return m_idx != it.m_idx; }
460459
};
461460

@@ -614,7 +613,6 @@ class hilbert_basis::passive2 {
614613
offset_t sos() const { return (p.hb.vec(pas()).weight().is_pos()?p.m_neg_sos:p.m_pos_sos)[p.m_psos[m_idx]]; }
615614
iterator& operator++() { ++m_idx; fwd(); return *this; }
616615
iterator operator++(int) { iterator tmp = *this; ++*this; return tmp; }
617-
bool operator==(iterator const& it) const {return m_idx == it.m_idx; }
618616
bool operator!=(iterator const& it) const {return m_idx != it.m_idx; }
619617
};
620618

src/math/hilbert/hilbert_basis.h

-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ class hilbert_basis {
115115
offset_t operator*() const { return hb.m_basis[m_idx]; }
116116
iterator& operator++() { ++m_idx; return *this; }
117117
iterator operator++(int) { iterator tmp = *this; ++*this; return tmp; }
118-
bool operator==(iterator const& it) const {return m_idx == it.m_idx; }
119118
bool operator!=(iterator const& it) const {return m_idx != it.m_idx; }
120119
};
121120

src/math/lp/emonics.h

+2-5
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,8 @@ class emonics {
5151
unsigned m_index;
5252
};
5353
struct head_tail {
54-
head_tail(): m_head(nullptr), m_tail(nullptr) {}
55-
cell* m_head;
56-
cell* m_tail;
54+
cell* m_head = nullptr;
55+
cell* m_tail = nullptr;
5756
};
5857
struct hash_canonical {
5958
emonics& em;
@@ -205,7 +204,6 @@ class emonics {
205204
monic & operator*() { return m.m_monics[m_cell->m_index]; }
206205
iterator& operator++() { m_touched = true; m_cell = m_cell->m_next; return *this; }
207206
iterator operator++(int) { iterator tmp = *this; ++*this; return tmp; }
208-
bool operator==(iterator const& other) const { return m_cell == other.m_cell && m_touched == other.m_touched; }
209207
bool operator!=(iterator const& other) const { return m_cell != other.m_cell || m_touched != other.m_touched; }
210208
};
211209

@@ -239,7 +237,6 @@ class emonics {
239237
}
240238
pf_iterator& operator++() { ++m_it; fast_forward(); return *this; }
241239
pf_iterator operator++(int) { pf_iterator tmp = *this; ++*this; return tmp; }
242-
bool operator==(pf_iterator const& other) const { return m_it == other.m_it; }
243240
bool operator!=(pf_iterator const& other) const { return m_it != other.m_it; }
244241
};
245242

src/math/lp/explanation.h

+2-3
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,10 @@ class explanation {
106106
iterator(bool run_on_vector, pair_vec::const_iterator vi, ci_set::iterator cii) :
107107
m_run_on_vector(run_on_vector), m_vi(vi), m_ci(cii)
108108
{}
109-
bool operator==(const iterator &other) const {
109+
bool operator!=(const iterator &other) const {
110110
SASSERT(m_run_on_vector == other.m_run_on_vector);
111-
return m_run_on_vector? m_vi == other.m_vi : m_ci == other.m_ci;
111+
return m_run_on_vector ? m_vi != other.m_vi : m_ci != other.m_ci;
112112
}
113-
bool operator!=(const iterator &other) const { return !(*this == other); }
114113
};
115114

116115
iterator begin() const {

src/math/lp/factorization.cpp

+4-6
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,12 @@ const_iterator_mon::const_iterator_mon(const bool_vector& mask, const factorizat
9797
m_ff(f) ,
9898
m_full_factorization_returned(false)
9999
{}
100-
101-
bool const_iterator_mon::operator==(const const_iterator_mon::self_type &other) const {
100+
101+
bool const_iterator_mon::operator!=(const const_iterator_mon::self_type &other) const {
102102
return
103-
m_full_factorization_returned == other.m_full_factorization_returned &&
104-
m_mask == other.m_mask;
103+
m_full_factorization_returned != other.m_full_factorization_returned ||
104+
m_mask != other.m_mask;
105105
}
106-
107-
bool const_iterator_mon::operator!=(const const_iterator_mon::self_type &other) const { return !(*this == other); }
108106

109107
factorization const_iterator_mon::create_binary_factorization(factor j, factor k) const {
110108
factorization f(nullptr);

src/math/lp/factorization.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,7 @@ struct const_iterator_mon {
8888
self_type operator++(int);
8989

9090
const_iterator_mon(const bool_vector& mask, const factorization_factory *f);
91-
92-
bool operator==(const self_type &other) const;
91+
9392
bool operator!=(const self_type &other) const;
9493

9594
factorization create_binary_factorization(factor j, factor k) const;

src/math/lp/lar_constraints.h

-2
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,6 @@ class constraint_set {
203203
lar_base_constraint const* operator->() const { return &cs[m_index]; }
204204
iterator& operator++() { next(); return *this; }
205205
iterator operator++(int) { auto tmp = *this; next(); return tmp; }
206-
bool operator==(iterator const& other) const { return m_index == other.m_index; }
207206
bool operator!=(iterator const& other) const { return m_index != other.m_index; }
208207
};
209208
iterator begin() const { return iterator(cs, 0); }
@@ -229,7 +228,6 @@ class constraint_set {
229228
constraint_index const* operator->() const { return &m_index; }
230229
iterator& operator++() { next(); return *this; }
231230
iterator operator++(int) { auto tmp = *this; next(); return tmp; }
232-
bool operator==(iterator const& other) const { return m_index == other.m_index; }
233231
bool operator!=(iterator const& other) const { return m_index != other.m_index; }
234232
};
235233
iterator begin() const { return iterator(cs, 0); }

src/math/lp/lar_term.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,7 @@ class lar_term {
170170
const_iterator operator++() { const_iterator i = *this; m_it++; return i; }
171171
const_iterator operator++(int) { m_it++; return *this; }
172172
const_iterator(u_map<mpq>::iterator it) : m_it(it) {}
173-
bool operator==(const const_iterator &other) const { return m_it == other.m_it; }
174-
bool operator!=(const const_iterator &other) const { return !(*this == other); }
173+
bool operator!=(const const_iterator &other) const { return m_it != other.m_it; }
175174
};
176175

177176
bool is_normalized() const {

src/math/lp/var_eqs.h

-1
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,6 @@ class var_eqs {
302302
return signed_var(m_idx);
303303
}
304304
iterator& operator++() { m_idx = m_ve.m_uf.next(m_idx); m_touched = true; return *this; }
305-
bool operator==(iterator const& other) const { return m_idx == other.m_idx && m_touched == other.m_touched; }
306305
bool operator!=(iterator const& other) const { return m_idx != other.m_idx || m_touched != other.m_touched; }
307306
};
308307

src/math/simplex/bit_matrix.h

-2
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ class bit_matrix {
7171
unsigned const* operator->() const { return &m_column; }
7272
col_iterator& operator++() { next(); return *this; }
7373
col_iterator operator++(int) { auto tmp = *this; next(); return tmp; }
74-
bool operator==(col_iterator const& other) const { return m_column == other.m_column; }
7574
bool operator!=(col_iterator const& other) const { return m_column != other.m_column; }
7675
};
7776

@@ -88,7 +87,6 @@ class bit_matrix {
8887
row* operator->() { return &m_row; }
8988
row_iterator& operator++() { next(); return *this; }
9089
row_iterator operator++(int) { auto tmp = *this; next(); return tmp; }
91-
bool operator==(row_iterator const& other) const { return m_index == other.m_index; }
9290
bool operator!=(row_iterator const& other) const { return m_index != other.m_index; }
9391
};
9492

src/math/simplex/sparse_matrix.h

-2
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,6 @@ namespace simplex {
198198
row_entry * operator->() const { return &(operator*()); }
199199
row_iterator & operator++() { ++m_curr; move_to_used(); return *this; }
200200
row_iterator operator++(int) { row_iterator tmp = *this; ++*this; return tmp; }
201-
bool operator==(row_iterator const & it) const { return m_curr == it.m_curr; }
202201
bool operator!=(row_iterator const & it) const { return m_curr != it.m_curr; }
203202
};
204203

@@ -308,7 +307,6 @@ namespace simplex {
308307
row operator*() { return row(m_curr); }
309308
all_row_iterator & operator++() { m_curr++; move_to_next(); return *this; }
310309
all_row_iterator operator++(int) { all_row_iterator tmp = *this; ++*this; return tmp; }
311-
bool operator==(all_row_iterator const& it) const { return m_curr == it.m_curr; }
312310
bool operator!=(all_row_iterator const& it) const { return m_curr != it.m_curr; }
313311
};
314312

src/muz/rel/dl_table.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ namespace datalog {
122122
m_end(t.m_data.end()), m_row_obj(*this) {}
123123

124124
bool is_finished() const override {
125-
return m_inner==m_end;
125+
return !(m_inner != m_end);
126126
}
127127

128128
row_interface & operator*() override {

src/qe/qe.h

-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ namespace qe {
123123
iterator(conj_enum& c, bool first) : m_super(&c), m_index(first?0:c.m_conjs.size()) {}
124124
expr* operator*() { return m_super->m_conjs[m_index].get(); }
125125
iterator& operator++() { m_index++; return *this; }
126-
bool operator==(iterator const& it) const { return m_index == it.m_index; }
127126
bool operator!=(iterator const& it) const { return m_index != it.m_index; }
128127
};
129128

src/sat/dimacs.h

-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ namespace dimacs {
9494
iterator(drat_parser& p, bool is_eof):p(p), m_eof(is_eof) { if (!m_eof) m_eof = !p.next(); }
9595
drat_record const& operator*() { return p.m_record; }
9696
iterator& operator++() { if (!p.next()) m_eof = true; return *this;}
97-
bool operator==(iterator const& other) const { return m_eof == other.m_eof; }
9897
bool operator!=(iterator const& other) const { return m_eof != other.m_eof; }
9998
};
10099

src/sat/sat_clause.h

-1
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,6 @@ namespace sat {
188188
iterator(clause_wrapper const& c, unsigned idx): m_idx(idx), m_cw(c) {}
189189
iterator& operator++() { ++m_idx; return *this; }
190190
literal operator*() { return m_cw[m_idx]; }
191-
bool operator==(iterator const& other) const { SASSERT(&m_cw == &other.m_cw); return m_idx == other.m_idx; }
192191
bool operator!=(iterator const& other) const { SASSERT(&m_cw == &other.m_cw); return m_idx != other.m_idx; }
193192
};
194193
iterator begin() const { return iterator(*this, 0); }

src/sat/smt/pb_constraint.h

-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ namespace pb {
125125
iterator(constraint const& c, unsigned idx) : c(c), idx(idx) {}
126126
literal operator*() { return c.get_lit(idx); }
127127
iterator& operator++() { ++idx; return *this; }
128-
bool operator==(iterator const& other) const { SASSERT(&c == &other.c); return idx == other.idx; }
129128
bool operator!=(iterator const& other) const { SASSERT(&c == &other.c); return idx != other.idx; }
130129
};
131130

src/smt/smt_enode.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -360,8 +360,7 @@ namespace smt {
360360
enode* operator*() { return m_first; }
361361
iterator& operator++() { if (!m_last) m_last = m_first; m_first = m_first->m_next; return *this; }
362362
iterator operator++(int) { iterator tmp = *this; ++*this; return tmp; }
363-
bool operator==(iterator const& other) const { return m_last == other.m_last && m_first == other.m_first; }
364-
bool operator!=(iterator const& other) const { return !(*this == other); }
363+
bool operator!=(iterator const& other) const { return m_last != other.m_last || m_first != other.m_first; }
365364
};
366365

367366
iterator begin() { return iterator(this, nullptr); }

src/util/approx_set.h

-4
Original file line numberDiff line numberDiff line change
@@ -197,10 +197,6 @@ class approx_set : public u_approx_set {
197197
++*this;
198198
return tmp;
199199
}
200-
201-
bool operator==(iterator const & it) const {
202-
return m_set == it.m_set;
203-
}
204200

205201
bool operator!=(iterator const & it) const {
206202
return m_set != it.m_set;

src/util/bit_vector.h

-1
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,6 @@ class bit_vector {
220220
bool operator*() const { return b.get(m_curr); }
221221
iterator& operator++() { ++m_curr; return *this; }
222222
iterator operator++(int) { iterator tmp = *this; ++* this; return tmp; }
223-
bool operator==(iterator const& it) const { return m_curr == it.m_curr; }
224223
bool operator!=(iterator const& it) const { return m_curr != it.m_curr; }
225224
};
226225

src/util/chashtable.h

-1
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,6 @@ class chashtable : private HashProc, private EqProc {
551551
return *this;
552552
}
553553
iterator operator++(int) { iterator tmp = *this; ++*this; return tmp; }
554-
bool operator==(iterator const & it) const { return m_list_it == it.m_list_it; }
555554
bool operator!=(iterator const & it) const { return m_list_it != it.m_list_it; }
556555
};
557556

src/util/distribution.h

-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ class distribution {
9595
next_index();
9696
return *this;
9797
}
98-
bool operator==(iterator const& other) const { return m_sz == other.m_sz; }
9998
bool operator!=(iterator const& other) const { return m_sz != other.m_sz; }
10099
};
101100

src/util/dlist.h

+1-6
Original file line numberDiff line numberDiff line change
@@ -213,13 +213,8 @@ class dll_iterator {
213213
T const& operator*() const {
214214
return *m_elem;
215215
}
216-
217-
bool operator==(dll_iterator const& other) const {
218-
return m_elem == other.m_elem && m_first == other.m_first;
219-
}
220-
221216
bool operator!=(dll_iterator const& other) const {
222-
return !operator==(other);
217+
return m_elem != other.m_elem || m_first != other.m_first;
223218
}
224219
};
225220

src/util/list.h

-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ class list {
4444
T const & operator*() const { return m_curr->head(); }
4545
iterator & operator++() { m_curr = m_curr->tail(); return *this; }
4646
iterator operator++(int) { iterator tmp = *this; ++*this; return tmp; }
47-
bool operator==(iterator const & it) { return m_curr == it.m_curr; }
4847
bool operator!=(iterator const & it) { return m_curr != it.m_curr; }
4948
};
5049

src/util/scoped_vector.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,7 @@ class scoped_vector {
106106
unsigned m_index;
107107
public:
108108
iterator(scoped_vector const& v, unsigned idx): m_vec(v), m_index(idx) {}
109-
110-
bool operator==(iterator const& other) const { return &other.m_vec == &m_vec && other.m_index == m_index; }
109+
111110
bool operator!=(iterator const& other) const { return &other.m_vec != &m_vec || other.m_index != m_index; }
112111
T const& operator*() { return m_vec[m_index]; }
113112

0 commit comments

Comments
 (0)