Boost logo

Boost :

From: Joe Gottman (jgottman_at_[hidden])
Date: 2006-10-25 20:06:16


"Emil Dotchevski" <emildotchevski_at_[hidden]> wrote in message
news:BAY102-DAV10CB89F05952821C9EE4CBD4060_at_phx.gbl...
>I think it would be useful to add the following features to shared_ptr:
>
> 1. Support for aliasing: if I have a shared_ptr<T> pt, to get a
> shared_ptr<Y> py (where T and Y are possibly unrelated types) such that pt
> and py share ownership. For example, if T is an array of elements of type
> Y,
> with this feature pointing an element from the array through a
> shared_ptr<Y>
> would keep the entire array afloat. Similar example is being able to point
> through a shared_ptr<Y> to a member of an object of class T, which would
> keep the entire T object afloat.

   We currently have static_pointer_cast, dynamic_pointer_cast, and
const_pointer_cast, which, naturally enough, perform static_cast,
dynamic_cast, and const_cast on the underlying pointer. What you are asking
for is basically a reinterpret_pointer_cast. If you can give a use case it
seems natural enough.

Joe Gottman


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