Boost logo

Boost Users :

From: Andrew Holden (aholden_at_[hidden])
Date: 2007-10-02 14:11:13


Peter Dimov wrote:
> In this case, you can use
>
> struct B : A
> {
> shared_ptr<B> getB()
> {
> return dynamic_pointer_cast<B>( shared_from_this() ); }
> };
>
> after making A polymorphic.

Is there any reason you couldn't use static_pointer_cast? You know for
a fact that the cast to B will work, as getB is a member function of B.
I think this will also remove the need to make A polymorphic.


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