Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-04-19 15:42:40


From: "Fernando Cacciola" <fcacciola_at_[hidden]>
> int main()
> {
> boost::intrusive_ptr<X> px(new X); // obj's internal count=1
> boost::intrusive_ptr<X> px2(px); // obj's internal count=2
> boost::shared_ptr<X> px3(px2); // obj's internal count still =2,
detached
> count=1
>
> px = 0; // obj's internal count=1
> px2 = 0; // obj's internal count=0 -----> obj suicides itself....
>
> *px3 ; // undefined behavior, pointee no longer alive.
> }
>
> What I am missing?

Try it. :-)


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