Skip to content

Commit

Permalink
CNodeRef copy constructor and assignment operator
Browse files Browse the repository at this point in the history
  • Loading branch information
pstratem committed Aug 25, 2015
1 parent dc81dd0 commit 69ee1aa
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,22 @@ class CNodeRef {

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;
};
Expand Down

0 comments on commit 69ee1aa

Please sign in to comment.