18 Oct
2006
18 Oct
'06
8:16 a.m.
I thought each time you inherit from enable_shared_from_this<T> you get a new reference count, so with the code below, won't you end up with 2 separate reference counts to the same instance? I thought this was a limitation of shared_from_this. Russell Johan Nilsson wrote:
Do you mean something like this?
---------
#include
struct A : boost::enable_shared_from_this<A> {};
struct B : A , boost::enable_shared_from_this<B> { boost::shared_ptr<B> FooB() { return boost::enable_shared_from_this<B>::shared_from_this(); }
boost::shared_ptr<A> FooA() { return boost::enable_shared_from_this<A>::shared_from_this(); } };
------------
HTH // Johan