3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-23 17:15:31 +00:00

removing const qualifiers, perhaps this helps for #420 and adding assert to enable Clang analysis earlier for issue #440

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2016-02-09 22:23:37 +00:00
parent 60c0e73b2f
commit 5ce85aba40
8 changed files with 86 additions and 87 deletions

View file

@ -32,8 +32,8 @@ protected:
void free_memory() {
if (m_buffer != reinterpret_cast<T*>(m_initial_buffer)) {
memory::deallocate(m_buffer);
}
dealloc_svect(m_buffer);
}
}
void expand() {
@ -66,57 +66,57 @@ public:
typedef const T * const_iterator;
buffer():
m_buffer(reinterpret_cast<T *>(m_initial_buffer)),
m_pos(0),
m_capacity(INITIAL_SIZE) {
m_buffer(reinterpret_cast<T *>(m_initial_buffer)),
m_pos(0),
m_capacity(INITIAL_SIZE) {
}
buffer(const buffer & source):
m_buffer(reinterpret_cast<T *>(m_initial_buffer)),
m_pos(0),
m_capacity(INITIAL_SIZE) {
m_buffer(reinterpret_cast<T *>(m_initial_buffer)),
m_pos(0),
m_capacity(INITIAL_SIZE) {
unsigned sz = source.size();
for(unsigned i = 0; i < sz; i++) {
push_back(source.m_buffer[i]);
}
}
buffer(unsigned sz, const T & elem):
m_buffer(reinterpret_cast<T *>(m_initial_buffer)),
m_pos(0),
m_capacity(INITIAL_SIZE) {
m_buffer(reinterpret_cast<T *>(m_initial_buffer)),
m_pos(0),
m_capacity(INITIAL_SIZE) {
for (unsigned i = 0; i < sz; i++) {
push_back(elem);
}
SASSERT(size() == sz);
}
~buffer() {
destroy();
}
void reset() {
if (CallDestructors) {
destroy_elements();
}
m_pos = 0;
}
void finalize() {
destroy();
m_buffer = reinterpret_cast<T *>(m_initial_buffer);
m_pos = 0;
m_capacity = INITIAL_SIZE;
}
unsigned size() const {
return m_pos;
}
bool empty() const {
return m_pos == 0;
}
iterator begin() {
return m_buffer;
}
@ -130,15 +130,15 @@ public:
if (CallDestructors) {
iterator e = end();
for (; it != e; ++it) {
it->~T();
it->~T();
}
}
}
const_iterator begin() const {
return m_buffer;
}
const_iterator end() const {
return m_buffer + size();
}