
27 Jun
2008
27 Jun
'08
11 p.m.
Hi, These might've been ask and answered already - can 't find it though. 1. Why doesn't intrusive_ptr have reset( T* )? 2. Why there is no something like this provided by the header: template<typename Derived> class intrusive_base { protected: intrusive_base() : m_counter( 0 ) {} private: friend void intrusive_ptr_add_ref( Derived* p ) { ++p->m_counter; } friend void intrusive_ptr_release( Derived* p ) { --p->m_counter; if( !p->m_counter ) delete p; } unsigned m_counter; }; to be used like this: class Foo : intrusive_base<Foo> { ... }; This should streamline intrusive_ptr class usage, isn't it? Or there is an alternative way already? Gennadiy