$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Borgerding, Mark A. (MarkAB_at_[hidden])
Date: 2000-07-28 08:03:07
I looked at it closer and the type safety is already guaranteed because of
the construction of
px by r.get() -- so the function was fine in its original form.
> -----Original Message-----
> From: Borgerding, Mark A. [mailto:MarkAB_at_[hidden]]
> Sent: Friday, July 28, 2000 8:35 AM
> To: boost_at_[hidden]
> Subject: RE: [boost] shared_ptr implementation without
> template friends
>
>
> A ptr assignment in the template constructor can solve the
> problem of type
> relation:
>
> template<typename Y>
> shared_ptr(const shared_ptr<Y>& r) throw() : px(r.get()) {
> T * dummyptr = r.get();
> // this will not compile if Y* cannot be made a T*
> // a good compiler might be able to get rid of the runtime cost
> altogether
> ++*(pn = reinterpret_cast<const shared_ptr<T>&>( r ).pn);
> }
>