aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Strateman <patrick.strateman@gmail.com>2015-08-25 15:33:29 -0700
committerPatrick Strateman <patrick.strateman@gmail.com>2015-08-25 15:33:29 -0700
commit69ee1aab00b9189865dfca6fb5c33c61a3c3ea67 (patch)
treebb01c3191c1b86126dc2e11cb45a23a54ae13914
parentdc81dd02a1d5f47ca45f74577e0696dfba6fa15c (diff)
CNodeRef copy constructor and assignment operator
-rw-r--r--src/net.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/net.cpp b/src/net.cpp
index 4f4c7b81c4..cb5a24f0a4 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -782,6 +782,22 @@ public:
CNode& operator *() const {return *_pnode;};
CNode* operator ->() const {return _pnode;};
+
+ CNodeRef& operator =(const CNodeRef& other)
+ {
+ if (this != &other) {
+ _pnode->Release();
+ _pnode = other._pnode;
+ _pnode->AddRef();
+ }
+ return *this;
+ }
+
+ CNodeRef(const CNodeRef& other):
+ _pnode(other._pnode)
+ {
+ _pnode->AddRef();
+ }
private:
CNode *_pnode;
};