Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2002-11-17 23:27:38

"Peter Dimov" <pdimov_at_[hidden]> writes:

> From: "Eric Woodruff" <Eric.Woodruff_at_[hidden]>
>> "David Abrahams" <dave_at_[hidden]> wrote in message
>> > "Peter Dimov" <pdimov_at_[hidden]> 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_at_[hidden] *
Boost support, enhancements, training, and commercial distribution

Boost list run by bdawes at, gregod at, cpdaniel at, john at