Boost logo

Boost :

From: Michael VanLoon (MichaelV_at_[hidden])
Date: 2001-03-19 18:01:40


> From: Greg Colvin [mailto:gcolvin_at_[hidden]]
> Sent: Monday, March 19, 2001 12:21 AM
>
> 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.

Actually I have written a fully-implemented polymorphic smart-pointer that
has been used for more than a year at my company. I have been toying with
releasing it to the public, but need to get employer approval to do so.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk