From: Amos Jeffries Date: Fri, 18 Aug 2023 00:39:36 +0000 (+0000) Subject: Define RefCount nullptr assignment operator (#1459) X-Git-Tag: SQUID_7_0_1~367 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=da200536aa0cf5d86d49617085cc0f221ae2a402;p=thirdparty%2Fsquid.git Define RefCount nullptr assignment operator (#1459) If RefCount(C*) constructor becomes private, this change will be needed to use 'foo=nullptr' syntax to clear a Pointer. --- diff --git a/src/base/RefCount.h b/src/base/RefCount.h index 60d8c2093c..782b9b52da 100644 --- a/src/base/RefCount.h +++ b/src/base/RefCount.h @@ -66,6 +66,8 @@ public: return *this; } + RefCount &operator =(std::nullptr_t) { dereference(); return *this; } + explicit operator bool() const { return p_; } bool operator !() const { return !p_; }