Skip to content

Commit

Permalink
union_find::reserve
Browse files Browse the repository at this point in the history
  • Loading branch information
JakobR authored and NikolajBjorner committed Aug 1, 2022
1 parent e8e64d3 commit 5d858da
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/util/uint_set.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ class uint_set : unsigned_vector {
m_set(&s), m_index(at_end?s.get_max_elem():0), m_last(s.get_max_elem()) {
scan();
SASSERT(invariant());
}
}
unsigned operator*() const { return m_index; }
bool operator==(iterator const& it) const { return m_index == it.m_index; }
bool operator!=(iterator const& it) const { return m_index != it.m_index; }
Expand Down
5 changes: 5 additions & 0 deletions src/util/union_find.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ class union_find {
return r;
}

void reserve(unsigned v) {
while (get_num_vars() <= v)
mk_var();
}

unsigned get_num_vars() const { return m_find.size(); }


Expand Down

0 comments on commit 5d858da

Please sign in to comment.