
18 Mar
2011
18 Mar
'11
9:41 p.m.
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.