
1 Oct
2011
1 Oct
'11
6:07 p.m.
Igor R
<...>
I read on google that you can only use shared_from_this on ONE class type
in a
class hierarchy. I did not understand the details of why.
You probably mean that you should inherit enable_shared_from_this only once. But then you can use shared_from_this wherever you wish.
I inherited from enable_shared_from_this in my base class. When I called shared_from_this() in my derived class it throws an exception. When I go up the call stack I see that in the boost implementation weak_ptr is NULL and count is NULL. I ensured the derived class was instatiated as a shared_ptr by using a fatory method. I don't know what else to do.