
17 Mar
2011
17 Mar
'11
6:53 p.m.
Frank wrote on Thursday, March 17, 2011 at 21:26:02:
It violates the fundamental premise of shared_ptr: shared ownership. Whoever deletes the object directly is taking total ownership of the object.
you misunderstood the point is that hypothetical_smart_ptr<int> p = new int, //allocating data q; p = q; //data intended to be shared now delete p; //equivalent to 'p.reset()' in the 'shared_ptr' case delete q; //<--actually releases allocated data it deletes or otherwise releases guarded resource only if no other smart pointer holds a reference to the resource -- Pavel P.S. if you notice a grammar mistake or weird phrasing in my message please point it out