]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Unlink RefCount smart-pointer constness from its data.
authorAmos Jeffries <amosjeffries@squid-cache.org>
Tue, 5 Oct 2010 11:43:27 +0000 (05:43 -0600)
committerAmos Jeffries <amosjeffries@squid-cache.org>
Tue, 5 Oct 2010 11:43:27 +0000 (05:43 -0600)
Reason for having this in the first place is unknown. Several of the dev
agree there seems to be no reason to keep it and many to remove:

 * The data RefCount points to is always dynamic
 * The data pointed to is deleted with the last reference
 * Its desirable to pass pointers around as const knowing that they will
   not be changed to point at another object, but still manipulate the
   data object itself.

include/RefCount.h

index a6281b249756c21ce0d75380e9d19565639d482a..25253eb2fe2b3071f80f30fd7f1e6427d924658a 100644 (file)
@@ -69,13 +69,9 @@ public:
 
     bool operator !() const { return !p_; }
 
-    C const * operator-> () const {return p_; }
+    C * operator-> () const {return const_cast<C *>(p_); }
 
-    C * operator-> () {return const_cast<C *>(p_); }
-
-    C const & operator * () const {return *p_; }
-
-    C & operator * () {return *const_cast<C *>(p_); }
+    C & operator * () const {return *const_cast<C *>(p_); }
 
     C const * getRaw() const {return p_; }