Boost logo

Boost :

From: Douglas Gregor (gregod_at_[hidden])
Date: 2002-07-17 16:06:04


On Wednesday 17 July 2002 04:56 pm, David Abrahams wrote:
> From: "Ed Brey" <brey_at_[hidden]>
>
> > Perhaps the best option would be to merge the two. Just as shared_ptr
>
> "auto-detects" a counted base and becomes more efficient, would it not be
> reasonable to take that to the next level so that shared_ptr elides is
> pointer-to-count member given a counted base? (I'm not sure how to
> implement this off hand.) Then, aside from accepting raw pointers, there'd
> be no difference between intrusive_ptr and shared_ptr. Correct?

This can't be done safely:

// Translation unit 1
class Foo;
boost::shared_ptr<Foo> f; // reference count in shared_ptr

// Translation unit 2
class Foo : public boost::counted_base
{
// ...
};
boost::shared_ptr<Foo> f; // reference count in counted_base

        Doug


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