]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Make RefCount pointers behave more like regular pointers.
authorAlex Rousskov <rousskov@measurement-factory.com>
Wed, 18 Nov 2015 05:32:24 +0000 (22:32 -0700)
committerAlex Rousskov <rousskov@measurement-factory.com>
Wed, 18 Nov 2015 05:32:24 +0000 (22:32 -0700)
Allow default (but safe, thanks to C++11) conversion of RefCount
pointers to bool. This helps keep the code succinct, minimizes changes
during conversion of reference counting pointers to/from other pointer
types, and avoids nullptr/NULL differences.

src/base/RefCount.h

index ec2a98c9d7dfb958a6a121b8e15caed0cfc7486f..85a5477249901e016548870a5c696e00fb7e2384 100644 (file)
@@ -64,6 +64,8 @@ public:
     }
 #endif
 
+    explicit operator bool() const { return p_; }
+
     bool operator !() const { return !p_; }
 
     C * operator-> () const {return const_cast<C *>(p_); }