3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-03-02 19:56:54 +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:
copilot-swe-agent[bot] 2026-03-01 02:10:19 +00:00
parent 137fd735f5
commit 23d194502a

View file

@ -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;