From: Francesco Chemolli Date: Thu, 19 Feb 2015 16:11:58 +0000 (+0100) Subject: Implemented c++11 move operations for RefCount X-Git-Tag: merge-candidate-3-v1~253^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4734907518a30fdf366b1a7697af8e8a08618d18;p=thirdparty%2Fsquid.git Implemented c++11 move operations for RefCount --- diff --git a/src/base/RefCount.h b/src/base/RefCount.h index 1e196cb735..84605a8f66 100644 --- a/src/base/RefCount.h +++ b/src/base/RefCount.h @@ -39,6 +39,10 @@ public: reference (p); } + RefCount (RefCount &&p) : p_(std::move(p.p_)) { + p.p_=NULL; + } + RefCount& operator = (const RefCount& p) { // DO NOT CHANGE THE ORDER HERE!!! // This preserves semantics on self assignment @@ -48,6 +52,12 @@ public: return *this; } + RefCount& operator = (RefCount&& p) { + p_ = std::move(p.p_); + p.p_ = NULL; + return *this; + } + bool operator !() const { return !p_; } C * operator-> () const {return const_cast(p_); }