
1 Aug
2008
1 Aug
'08
10:19 a.m.
I did not do that, because shared_ptr does not. Counter should be a part of policy too, like: struct trivial_increment_policy { void inc( ) { ++c; } bool dec( ) { return --c == 0; } size_t c; } template<class Derived, template IncrementPolicy=trivial_increment_policy> class intrusive_pointee_base { private: typedef intrusive_pointee_base self; protected: intrusive_pointee_base(void) : reference_counter_() {} intrusive_pointee_base(self const&) : reference_counter_() {} self& operator=(self const&) { return *this } ~intrusive_pointee_base(void) {} mutable reference_counter_; };