|
Boost : |
From: Greg Colvin (gcolvin_at_[hidden])
Date: 2001-03-19 03:20:37
From: Kevlin Henney <kevlin_at_[hidden]>
> In message <034e01c0afc7$09032e50$37781990_at_[hidden]>, Greg Colvin
> <gcolvin_at_[hidden]> writes
> >From: Eric Ford <eford_at_[hidden]>
> >> I'm using the counted_ptr from http://ootips.org/yonat/4dev/ which is
> >> similar to boost's shared_ptr. However, I've run into a problem. I'm
> >> willing to switch to the boost smart pointers, if they offer a
> >> solution
> >> to my problem. (But I'm guessing that a solution for one would work for
> >> the other.) Any help with either would be appreciated...
> >>
> >> I have an STL container of counted_ptr<A>'s. At some point I need to
> >> do a dynamic downcast of a counted_ptr<A> to a counted_ptr<B>. How do
> >> I do that?
> >
> >Right now you don't. It has been on our chronic list of
> >missing features for a long time but no one has been
> >motivated enough to contibute a solution.
>
> I may be mistaken, but I thought it had been discussed and possible code
> samples had been posted some time back -- something like
> dynamic_shared_cast.
Yes, but that's as far as it got. I think the name was
do_dynamic_cast, and it was supposed to work with both raw
and smart pointers. Now that we have boost/cast.hpp we
have a home for such a beast, and could do worse than just
implementing a polymorphic_cast for shared_ptr.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk