Boost logo

Boost :

Subject: Re: [boost] [smart_ptr] shared_ptr<T> T destructor required evenifadeleter function is provided
From: Peter Dimov (pdimov_at_[hidden])
Date: 2008-09-29 06:44:00


vicente.botet:
> Hello Peter,
>
> what about the following in which we don't transfer ownership. (Note that
> now X::create() return X*)
>
> int main () {
> shared_ptr<X> ptr(X::create(), X::deleter());
> ptr.reset(X::create());

This is the equivalent of doing

    shared_ptr<X> ptr( X::create() );

which you're explicitly trying to prevent. The equivalent of

> shared_ptr<X> ptr(X::create(), X::deleter());

is

    ptr.reset( X::create(), X::deleter() );

> return 0;
> }


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