add operator bool() for smart pointer
authorFelix Domke <tmbinc@elitedvb.net>
Thu, 29 Sep 2005 22:11:43 +0000 (22:11 +0000)
committerFelix Domke <tmbinc@elitedvb.net>
Thu, 29 Sep 2005 22:11:43 +0000 (22:11 +0000)
lib/base/smartptr.h

index f9d224b0b445b47a26dbb313f742ec0dcd5a8b14..814d7457e29eafaa0420012b7cb53fbb6c93c40c 100644 (file)
@@ -56,6 +56,8 @@ public:
        T* &ptrref() { assert(!ptr); return ptr; }
        T* operator->() const { assert(ptr); return ptr; }
        operator T*() const { return this->ptr; }
        T* &ptrref() { assert(!ptr); return ptr; }
        T* operator->() const { assert(ptr); return ptr; }
        operator T*() const { return this->ptr; }
+       
+       operator bool() const { return !!this->ptr; }
 };
 
 
 };