Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-04-19 10:43:24


From: <DKl_at_[hidden]>
> My point is that there should be one smart pointer type to be used for
> passing "pointers" to 'T' around: This type appears in interfaces.

There is. It's called shared_ptr.

This is not the end of story, however. For example, a factory that creates
an object on the heap and transfers ownership to the user should return an
auto_ptr, not a shared_ptr. Similarly, a function that returns a pointer to
an object derived from counted_base should return an intrusive_ptr, not
shared_ptr. This is not an interoperability problem since both can be
converted to a shared_ptr; it's "as if" a shared_ptr is being returned.


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