Boost logo

Boost :

From: martinschuerch_at_[hidden]
Date: 2001-07-24 04:59:00


Thanks for the feedback
> I sent this hours ago, but it hasn't shown up, so I'll try again.
>
> This looks like a good start, thanks.
Thanks, a starting point is all it should be. Probably you noted the
bug with the missing return or else in the member-template.

> I think do_dynamic_cast is the
> name we previously agreed on for your shared_dynamic_cast, and that
> we wanted a version that worked for raw pointers as well. And it
> would still be good to have a polymorphic_cast for shared_ptr.
Must
> doing so really create dependencies?
Sorry, I didn't know that there were already some discussions about
the names. As long there is a do_dynamic_cast in the smartptr.hpp an
integration in polymorphic_cast is just perfect for me.

I didn' found the messages with the discussion about a raw-pointer
version. Can anybody give me the message-id?

Martin

> > Member-template:
> >
> > template<class Q>
> > void downcasted_copy_to( shared_ptr<Q>& q ) const
> > {
> > Q* rawq = dynamic_cast<Q*>(px);
> > if( !rawq || !px ) { q = shared_ptr<Q>(); }
                                             ^^return ;
> > shared_ptr<Q> ptmp;
> > ptmp.px = rawq;
> > ++*pn;
> > ptmp.pn = pn;
> > q.swap( ptmp );
> > }


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