|
Boost : |
From: David B. Held (dheld_at_[hidden])
Date: 2002-06-19 12:01:00
"David B. Held" <dheld_at_[hidden]> wrote in message
news:aephlt$28p$1_at_main.gmane.org...
> [...]
> class foo : boost::counted_base
Obviously, you can't inherit privately, or nobody will know this is really
a counted_base class.
Of course, one of the primary benefits of an intrusive pointer is the
ability to create one from a raw pointer. I should have illustrated that,
like so:
{
foo* x;
boost::intrusive_ptr<foo> p(x = new foo);
// count is 1
p->bar();
{
boost::shared_ptr<foo> q(p);
// count is 2
boost::intrusive_ptr<foo>r(x);
// count is 3
q->bar();
}
// count is 1
}
// count is 0, foo destroyed
Dave
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk