Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2006-10-26 18:24:17

Emil Dotchevski wrote:

> template <class T>
> shared_ptr
> {
> ....
> template <class Y>
> shared_ptr( shared_ptr<Y> const & sp, T * p ): px(p), pn(
> {
> }
> ....
> };

This has already been proposed in

along with a few other features. On the one hand, when you need it, it's
unquestionably useful and carries no additional overhead. I also like how
the casts are now implementable via the public interface. On the other hand,
it could be argued that this constructor makes it uncomfortably easy to
construct a shared_ptr that can dangle (because the lifetime of p is not
properly bounded by sp.)

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