Boost logo

Boost Users :

From: sashan (sashang_at_[hidden])
Date: 2003-10-21 20:28:11


>
>
> 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.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net