Exemple #1
0
 void clause_set::insert(clause & c) {
     unsigned id  = c.id();
     m_id2pos.reserve(id+1, UINT_MAX);
     if (m_id2pos[id] != UINT_MAX)
         return; // already in the set
     unsigned pos = m_set.size();
     m_id2pos[id] = pos;
     m_set.push_back(&c);
     CASSERT("clause_set", check_invariant());
 }
Exemple #2
0
 void clause_set::erase(clause & c) { 
     unsigned id = c.id();
     if (id >= m_id2pos.size())
         return;
     unsigned pos = m_id2pos[id];
     if (pos == UINT_MAX)
         return;
     m_id2pos[id] = UINT_MAX;
     unsigned last_pos = m_set.size() - 1;
     if (pos != last_pos) {
         clause * last_c = m_set[last_pos];
         m_set[pos] = last_c; 
         m_id2pos[last_c->id()] = pos;
     }
     m_set.pop_back();
     CASSERT("clause_set", check_invariant());
 }