mirror of
https://github.com/Z3Prover/z3
synced 2026-03-02 03:36:53 +00:00
Simplify def_ref smart pointer: default ctor, init list, clearer bool, remove extra semicolon
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
This commit is contained in:
parent
137fd735f5
commit
23d194502a
1 changed files with 5 additions and 5 deletions
|
|
@ -117,9 +117,9 @@ namespace opt {
|
|||
class def_ref {
|
||||
def* m_def = nullptr;
|
||||
public:
|
||||
def_ref(def* d) {
|
||||
if (d) d->inc_ref();
|
||||
m_def = d;
|
||||
def_ref() = default;
|
||||
def_ref(def* d) : m_def(d) {
|
||||
if (m_def) m_def->inc_ref();
|
||||
}
|
||||
def_ref(def_ref const& other) : m_def(other.m_def) {
|
||||
if (m_def) m_def->inc_ref();
|
||||
|
|
@ -155,9 +155,9 @@ namespace opt {
|
|||
def& operator*() { return *m_def; }
|
||||
def* operator->() { 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 {
|
||||
def* x, *y;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue