3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-28 19:35:50 +00:00

more careful resize in int_set

Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
This commit is contained in:
Lev Nachmanson 2020-03-23 18:33:31 -07:00
parent 0ec12f497c
commit c16d90307b
4 changed files with 14 additions and 1 deletions

View file

@ -24,6 +24,7 @@ namespace lp {
// serves at a set of non-negative integers smaller than the set size
class int_set {
vector<int> m_data;
vector<int> m_resize_buffer;
public:
vector<int> m_index;
int_set(unsigned size): m_data(size, -1) {}
@ -56,6 +57,16 @@ public:
int operator[](unsigned j) const { return m_index[j]; }
void resize(unsigned size) {
if (size < data_size()) {
for (unsigned j: m_index) {
if (j > size)
m_resize_buffer.push_back(j);
}
for (unsigned j : m_resize_buffer)
erase(j);
std::cout << m_resize_buffer.size() << "\n";
m_resize_buffer.clear();
}
m_data.resize(size, -1);
}