Boost logo

Boost :

From: Gennadiy Rozental (rogeeff_at_[hidden])
Date: 2008-06-27 19:00:41


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 {
    intrusive_base() : m_counter( 0 ) {}

    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?


Boost list run by bdawes at, gregod at, cpdaniel at, john at