3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-23 17:15:31 +00:00

use iterators, update build icon for osx

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2017-07-01 16:58:40 -07:00
parent c66ec9d3f6
commit 031d7e1b59
3 changed files with 31 additions and 11 deletions

View file

@ -91,6 +91,31 @@ public:
SASSERT(invariant());
}
class iterator {
scoped_vector const& m_vec;
unsigned m_index;
public:
iterator(scoped_vector const& v, unsigned idx): m_vec(v), m_index(idx) {}
bool operator==(iterator const& other) const { return &other.m_vec == &m_vec && other.m_index == m_index; }
bool operator!=(iterator const& other) const { return &other.m_vec != &m_vec || other.m_index != m_index; }
T const& operator*() { return m_vec[m_index]; }
iterator & operator++() {
++m_index;
return *this;
}
iterator operator++(int) {
iterator r = *this;
++m_index;
return r;
}
};
iterator begin() { return iterator(*this, 0); }
iterator end() { return iterator(*this, m_size); }
void push_back(T const& t) {
set_index(m_size, m_elems.size());
m_elems.push_back(t);