Re: [boost] Re: Upcoming changes to shared_ptr
by David Abrahams other posts by this author
Nov 18 2002 4:27AM messages near this date
Re: [boost] Re: Upcoming changes to shared_ptr
|
Re: [boost] Upcoming changes to shared_ptr
"Peter Dimov" <pdimov@[...].net> writes:
> From: "Eric Woodruff" <Eric.Woodruff@[...].com>
> >
> > "David Abrahams" <dave@[...].com> wrote in message
> > news:uvg2w6j80.fsf@[...]..
> > > "Peter Dimov" <pdimov@[...].net> writes:
> > >
> > > > * shared_*_cast will be renamed to sp_*_cast.
> > >
> > > Why? Without rationale, this seems like a gratuitous change,
> > > especailly since "sp" doesn't mean much to me.
> > >
> >
> > Agreed. "sp" is so wonderfully expressive. Actually, I was going to voice
> a
> > complaint of that, but the ideal would overload dynamic_cast, but since it
> > is a language keyword, that can't happen. So I can kind of see sp_ as a
> > work-around for that.
>
> True, but consider also that dynamic_cast has a different interface:
>
> template<class Target, class Source> Target dynamic_cast(Source);
>
> so even if we could overload it, the syntax would have been
>
> shared_ptr<Y> py;
> shared_ptr<X> px = dynamic_cast< shared_ptr<X> >(py);
>
> > Alternatively, it could be named boost_dynamic_cast
> > and put in the global namespace, where it can be overloaded as needed by
> > boost.
>
> This doesn't look too good if you consider the possible boost->std
> transition. :-)
But "sp" does? <wink>
How about dynamic_pointer_cast<T> (x)?
Of course, we can make it work for regular pointers, too.
--
David Abrahams
dave@[...].com * http://www.boost-consulting.com
Boost support, enhancements, training, and commercial distribution
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Thread:
Peter Dimov
Peter Dimov
Dirk Gerrits
hugo duncan
Peter Dimov
David Abrahams
Peter Dimov
Peter Dimov
Eric Woodruff
Peter Dimov
David Abrahams
Peter Dimov
David Abrahams
Eric Woodruff
David Abrahams
|