Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2020-07-31 20:42:33

ÒÝÁØ Ñî wrote:

> Please check code on

As far as I can tell, rcgc_shared_ptr<T> calls the destructor of T as soon
as its destructor is invoked, regardless of whether other references exist.
That is,

int main()
    rcgc_shared_ptr<X> p1( new X );

        rcgc_shared_ptr<X> p2( p1 );
    } // ~X is called here

    // *p1 references a destroyed object here

This doesn't seem correct to me; the point of shared_ptr is to not call the
destructor of the pointee as long as references (such as p1 in the code
above) exist to it.

Boost list run by bdawes at, gregod at, cpdaniel at, john at