|
Boost : |
From: Gennadiy Rozental (rogeeff_at_[hidden])
Date: 2008-06-27 19:00:41
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
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk