22 Oct
2003
22 Oct
'03
1:28 a.m.
virtual void f() { shared_ptr<A> pA(shared_from_this()); shared_ptr<B> pB(dynamic_pointer_cast< shared_ptr<B> >(pA)); } };
I just realized if I replaced shared_ptr<B> pB(dynamic_pointer_cast< shared_ptr<B> >(pA)); with shared_ptr<B> pB(dynamic_pointer_cast< B >(pA)); It will compile. What I'd like to know is if this is the way to do it. Initially I thought that the enanble_shared_from_this_0.cpp was the way to go, however it generates a run-time error.