--- parser3/src/include/pa_pool.h 2003/01/23 16:08:01 1.86.2.4 +++ parser3/src/include/pa_pool.h 2003/01/24 11:33:02 1.86.2.7 @@ -9,7 +9,7 @@ #ifndef PA_POOL_H #define PA_POOL_H -static const char* IDENT_POOL_H="$Date: 2003/01/23 16:08:01 $"; +static const char* IDENT_POOL_H="$Date: 2003/01/24 11:33:02 $"; #include "pa_config_includes.h" @@ -273,7 +273,7 @@ public: ptr=src.get(); ptr->ref(); } - object_ptr& operator=(const object_ptr& src) { + object_ptr& operator=(const object_ptr& src) { if(this!=&src) if(ptr!=src.get()) { if(ptr) @@ -282,6 +282,7 @@ public: if(ptr) ptr->ref(); } + return *this; } ~object_ptr() { if(ptr) @@ -296,6 +297,13 @@ public: T *get() const { return ptr; } + // so one could assign object_ptr to object_ptr + operator object_ptr() { + return *this; + } + operator bool() { + return get()!=0; + } }; /// TEMPLATE CLASS smart_ptr, stolen from stl:auto_ptr @@ -327,10 +335,16 @@ public: T *release() const {((smart_ptr *)this)->_Owns = false; return (_Ptr); } + operator bool() { + return get(); + } private: bool _Owns; T *_Ptr; }; +// convinient types + +typedef smart_ptr CharPtr; #endif