From: Amos Jeffries Date: Tue, 5 Oct 2010 11:43:27 +0000 (-0600) Subject: Unlink RefCount smart-pointer constness from its data. X-Git-Tag: take1~200 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b0d531231780bf07310f9e652f138fbc14d62a0d;p=thirdparty%2Fsquid.git Unlink RefCount smart-pointer constness from its data. 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. --- diff --git a/include/RefCount.h b/include/RefCount.h index a6281b2497..25253eb2fe 100644 --- a/include/RefCount.h +++ b/include/RefCount.h @@ -69,13 +69,9 @@ public: bool operator !() const { return !p_; } - C const * operator-> () const {return p_; } + C * operator-> () const {return const_cast(p_); } - C * operator-> () {return const_cast(p_); } - - C const & operator * () const {return *p_; } - - C & operator * () {return *const_cast(p_); } + C & operator * () const {return *const_cast(p_); } C const * getRaw() const {return p_; }