]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Implemented c++11 move operations for RefCount
authorFrancesco Chemolli <kinkie@squid-cache.org>
Thu, 19 Feb 2015 16:11:58 +0000 (17:11 +0100)
committerFrancesco Chemolli <kinkie@squid-cache.org>
Thu, 19 Feb 2015 16:11:58 +0000 (17:11 +0100)
src/base/RefCount.h

index 1e196cb73533fccd4a3f36d117e6334c33953e2a..84605a8f66e2b5f4d03f59b42d40ec32ab20e2cf 100644 (file)
@@ -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<C *>(p_); }