feat(util): add method get_rc (mainly for debugging purposes)

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2014-04-17 10:36:54 -07:00
parent c78e6787aa
commit 9a3959eed1
2 changed files with 4 additions and 0 deletions

View file

@ -36,6 +36,8 @@ public:
bool contains(K const & k) const { return m_map.contains(mk_pair(k, T())); }
void erase(K const & k) { m_map.erase(mk_pair(k, T())); }
unsigned get_rc() const { return m_map.get_rc(); }
class ref {
rb_map & m_map;
K const & m_key;

View file

@ -287,6 +287,8 @@ public:
rb_tree & operator=(rb_tree const & s) { m_root = s.m_root; return *this; }
rb_tree & operator=(rb_tree && s) { m_root = s.m_root; return *this; }
unsigned get_rc() const { return m_root ? m_root->get_rc() : 0; }
void insert(T const & v) {
m_root = set_black(insert(m_root.steal(), v));
lean_assert(check_invariant());