mirror of
https://github.com/Z3Prover/z3
synced 2025-04-12 12:08:18 +00:00
ref/ref_vector minor convenience changes (#5322)
* Add ref_vector_core::push_back(ref<T>&&) * Make operator bool() explicit
This commit is contained in:
parent
50cf321171
commit
46f8b15c14
|
@ -153,7 +153,7 @@ public:
|
||||||
expr_ref_vector const &get_cube();
|
expr_ref_vector const &get_cube();
|
||||||
void update_cube(pob_ref const &p, expr_ref_vector &cube);
|
void update_cube(pob_ref const &p, expr_ref_vector &cube);
|
||||||
|
|
||||||
bool has_pob() {return m_pob;}
|
bool has_pob() {return !!m_pob;}
|
||||||
pob_ref &get_pob() {return m_pob;}
|
pob_ref &get_pob() {return m_pob;}
|
||||||
unsigned weakness() {return m_weakness;}
|
unsigned weakness() {return m_weakness;}
|
||||||
|
|
||||||
|
|
|
@ -66,10 +66,14 @@ public:
|
||||||
return m_ptr;
|
return m_ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
operator bool() const {
|
explicit operator bool() const {
|
||||||
return m_ptr != nullptr;
|
return m_ptr != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool operator!() const {
|
||||||
|
return m_ptr == nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
const T & operator*() const {
|
const T & operator*() const {
|
||||||
return *m_ptr;
|
return *m_ptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ Revision History:
|
||||||
|
|
||||||
#include "util/vector.h"
|
#include "util/vector.h"
|
||||||
#include "util/obj_ref.h"
|
#include "util/obj_ref.h"
|
||||||
|
#include "util/ref.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Vector of smart pointers.
|
\brief Vector of smart pointers.
|
||||||
|
@ -113,6 +114,11 @@ public:
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ref_vector_core& push_back(ref<T>&& n) {
|
||||||
|
m_nodes.push_back(n.detach());
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
void pop_back() {
|
void pop_back() {
|
||||||
SASSERT(!m_nodes.empty());
|
SASSERT(!m_nodes.empty());
|
||||||
T * n = m_nodes.back();
|
T * n = m_nodes.back();
|
||||||
|
|
Loading…
Reference in a new issue