mirror of
https://github.com/Z3Prover/z3
synced 2026-07-14 11:05:41 +00:00
Merge pull request #8814 from Z3Prover/copilot/simplify-def-ref-smart-pointer
Simplify def_ref smart pointer in model_based_opt.h
This commit is contained in:
commit
844731d99a
1 changed files with 5 additions and 5 deletions
|
|
@ -117,9 +117,9 @@ namespace opt {
|
||||||
class def_ref {
|
class def_ref {
|
||||||
def* m_def = nullptr;
|
def* m_def = nullptr;
|
||||||
public:
|
public:
|
||||||
def_ref(def* d) {
|
def_ref() = default;
|
||||||
if (d) d->inc_ref();
|
def_ref(def* d) : m_def(d) {
|
||||||
m_def = d;
|
if (m_def) m_def->inc_ref();
|
||||||
}
|
}
|
||||||
def_ref(def_ref const& other) : m_def(other.m_def) {
|
def_ref(def_ref const& other) : m_def(other.m_def) {
|
||||||
if (m_def) m_def->inc_ref();
|
if (m_def) m_def->inc_ref();
|
||||||
|
|
@ -155,9 +155,9 @@ namespace opt {
|
||||||
def& operator*() { return *m_def; }
|
def& operator*() { return *m_def; }
|
||||||
def* operator->() { return m_def; }
|
def* operator->() { return m_def; }
|
||||||
def const& operator*() const { return *m_def; }
|
def const& operator*() const { return *m_def; }
|
||||||
operator bool() const { return !!m_def; }
|
operator bool() const { return m_def != nullptr; }
|
||||||
|
|
||||||
~def_ref() { if (m_def) m_def->dec_ref(); };
|
~def_ref() { if (m_def) m_def->dec_ref(); }
|
||||||
};
|
};
|
||||||
struct add_def : public def {
|
struct add_def : public def {
|
||||||
def* x, *y;
|
def* x, *y;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue