mirror of
https://github.com/Z3Prover/z3
synced 2025-06-20 04:43:39 +00:00
Investigating std::vector and #5178
This commit is contained in:
parent
385109d484
commit
c03fac8390
4 changed files with 19 additions and 8 deletions
|
@ -34,7 +34,7 @@ public:
|
||||||
|
|
||||||
void flush() {
|
void flush() {
|
||||||
SASSERT(b.size() == A.size());
|
SASSERT(b.size() == A.size());
|
||||||
unsigned sz = A.size();
|
auto sz = A.size();
|
||||||
for (unsigned i = 0; i < sz; i++) {
|
for (unsigned i = 0; i < sz; i++) {
|
||||||
svector<numeral> & as = A[i];
|
svector<numeral> & as = A[i];
|
||||||
m.del(b[i]);
|
m.del(b[i]);
|
||||||
|
|
|
@ -133,7 +133,7 @@ namespace polynomial {
|
||||||
/**
|
/**
|
||||||
\brief Number of distinct factors (not counting multiplicities).
|
\brief Number of distinct factors (not counting multiplicities).
|
||||||
*/
|
*/
|
||||||
unsigned distinct_factors() const { return m_factors.size(); }
|
size_t distinct_factors() const { return m_factors.size(); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Number of distinct factors (counting multiplicities).
|
\brief Number of distinct factors (counting multiplicities).
|
||||||
|
|
|
@ -39,8 +39,9 @@ namespace opt {
|
||||||
class model_based_opt {
|
class model_based_opt {
|
||||||
public:
|
public:
|
||||||
struct var {
|
struct var {
|
||||||
unsigned m_id;
|
unsigned m_id { 0 };
|
||||||
rational m_coeff;
|
rational m_coeff;
|
||||||
|
var() {}
|
||||||
var(unsigned id, rational const& c): m_id(id), m_coeff(c) {}
|
var(unsigned id, rational const& c): m_id(id), m_coeff(c) {}
|
||||||
struct compare {
|
struct compare {
|
||||||
bool operator()(var x, var y) {
|
bool operator()(var x, var y) {
|
||||||
|
|
|
@ -53,6 +53,15 @@ Revision History:
|
||||||
// };
|
// };
|
||||||
//
|
//
|
||||||
|
|
||||||
|
// Note:
|
||||||
|
// polynomial.h contains declaration
|
||||||
|
// typedef svector<numeral> numeral_vector;
|
||||||
|
// it is crucial that it uses svector and not vector. The destructors on elements of the numeral vector are handled outside.
|
||||||
|
// Numeral gets instantiated by mpz and mpz does not support copy constructors.
|
||||||
|
// porting svector to vector is therefore blocked on the semantics of svector being
|
||||||
|
// copy-constructor free.
|
||||||
|
//
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
template<typename T, bool CallDestructors=true, typename SZ = unsigned>
|
template<typename T, bool CallDestructors=true, typename SZ = unsigned>
|
||||||
|
@ -63,13 +72,14 @@ public:
|
||||||
|
|
||||||
vector() {}
|
vector() {}
|
||||||
vector(SZ s) {
|
vector(SZ s) {
|
||||||
// resize(s, T());
|
// TODO resize(s, T());
|
||||||
}
|
}
|
||||||
vector(SZ s, T const& e) {
|
vector(SZ s, T const& e) {
|
||||||
// resize(s, e);
|
// TODO resize(s, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
vector(SZ s, T const* e) {
|
vector(SZ s, T const* e) {
|
||||||
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
void reset() { clear(); }
|
void reset() { clear(); }
|
||||||
|
@ -100,11 +110,11 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void erase(iterator pos) {
|
void erase(iterator pos) {
|
||||||
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
void erase(T const& e) {
|
void erase(T const& e) {
|
||||||
|
// TODO
|
||||||
}
|
}
|
||||||
void fill(T const & elem) {
|
void fill(T const & elem) {
|
||||||
for (auto& e : *this)
|
for (auto& e : *this)
|
||||||
|
@ -133,7 +143,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void append(unsigned n, T const* elems) {
|
void append(unsigned n, T const* elems) {
|
||||||
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
bool contains(T const & elem) const {
|
bool contains(T const & elem) const {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue