diff options
-rw-r--r-- | include/base.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/include/base.h b/include/base.h index 3d05b15cd..624e2174f 100644 --- a/include/base.h +++ b/include/base.h @@ -88,12 +88,13 @@ class reference : public reference_base public: reference() : value(0) { } reference(T* v) : value(v) { if (value) inc(value); } - reference<T>& operator=(T* v) + reference(const reference& v) : value(v.value) { if (value) inc(value); } + reference<T>& operator=(const reference<T>& other) { - if (v) - inc(v); + if (other.value) + inc(other.value); this->reference::~reference(); - value = v; + value = other.value; return *this; } |