Boost logo

Boost :

Subject: Re: [boost] deleting smart pointer
From: Peter Dimov (pdimov_at_[hidden])
Date: 2011-03-18 17:41:23


pavel wrote:

> rephrasing your words: how is 'delete p' a bad idea? it's obvious it is
> almost like 'p.reset()'

There is a specific compile-fail test in shared_ptr for 'delete p'. The
reason that you typically need this to be a compile-time error is that when
transitioning a large code base from raw pointers to shared_ptr you usually
want the compiler to point these out to you so that you can decide what to
do with them.


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