3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-24 01:25:31 +00:00

Polysat: forbidden intervals updates (#5230)

* Pop assign_eh

* Fix scoped_ptr_vector constructors, add detach()

* Need to copy the returned lemma

* Add test

* Basic inequality tests

* Return disjunctive lemma to caller
This commit is contained in:
Jakob Rath 2021-04-30 17:41:50 +02:00 committed by GitHub
parent d6e41de344
commit 0c4824f194
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 189 additions and 24 deletions

View file

@ -26,7 +26,22 @@ template<typename T>
class scoped_ptr_vector {
ptr_vector<T> m_vector;
public:
scoped_ptr_vector() = default;
~scoped_ptr_vector() { reset(); }
scoped_ptr_vector(scoped_ptr_vector& other) = delete;
scoped_ptr_vector& operator=(scoped_ptr_vector& other) = delete;
scoped_ptr_vector(scoped_ptr_vector&& other) noexcept {
m_vector.swap(other.m_vector);
}
scoped_ptr_vector& operator=(scoped_ptr_vector&& other) {
if (this == &other)
return *this;
reset();
m_vector.swap(other.m_vector);
return *this;
}
void reset() { std::for_each(m_vector.begin(), m_vector.end(), delete_proc<T>()); m_vector.reset(); }
void push_back(T * ptr) { m_vector.push_back(ptr); }
void pop_back() { SASSERT(!empty()); set(size()-1, nullptr); m_vector.pop_back(); }
@ -65,7 +80,15 @@ public:
ptr = m_vector.back();
m_vector[m_vector.size()-1] = tmp;
}
typename ptr_vector<T>::const_iterator begin() const { return m_vector.begin(); }
typename ptr_vector<T>::const_iterator end() const { return m_vector.end(); }
ptr_vector<T> detach() {
ptr_vector<T> tmp(std::move(m_vector));
SASSERT(m_vector.empty());
return tmp;
}
using const_iterator = typename ptr_vector<T>::const_iterator;
const_iterator begin() const { return m_vector.begin(); }
const_iterator end() const { return m_vector.end(); }
};

View file

@ -532,7 +532,7 @@ public:
return m_data;
}
void swap(vector & other) {
void swap(vector & other) noexcept {
std::swap(m_data, other.m_data);
}