3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-28 11:25:51 +00:00

use incremental vector

Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
This commit is contained in:
Lev Nachmanson 2019-05-13 15:49:08 -07:00
parent 94e3078920
commit d78cc4975a
2 changed files with 20 additions and 22 deletions

View file

@ -19,9 +19,6 @@ Revision History:
--*/
#pragma once
#include <unordered_map>
#include <set>
#include <stack>
#include "util/vector.h"
namespace lp {
template <typename B> class incremental_vector {
@ -36,12 +33,12 @@ public:
return m_vector.size();
}
void push() {
void push_scope() {
m_stack_of_vector_sizes.push_back(m_vector.size());
}
void pop() {
pop(1);
void pop_scope() {
pop_scope(1);
}
template <typename T>
@ -55,12 +52,12 @@ public:
v.resize(new_size);
}
void pop(unsigned k) {
void pop_scope(unsigned k) {
lp_assert(m_stack_of_vector_sizes.size() >= k);
lp_assert(k > 0);
m_vector.shrink(peek_size(k));
unsigned new_st_size = m_stack_of_vector_sizes.size() - k;
m_stack_of_vector_sizes.shrink(k);
m_stack_of_vector_sizes.shrink(new_st_size);
}
void push_back(const B & b) {