|
Boost Users : |
From: me22 (me22.ca_at_[hidden])
Date: 2006-01-16 20:16:14
On 16/01/06, Pierre THIERRY <nowhere.man_at_[hidden]> wrote:
> Is there a problem to have shared_ptr<T>::operator=(T*)?
>
As I understand it, it's not allowed so that it's very clear when it's
done. Once a pointer ends up in a shared_ptr, there's no way to get
it out of one, so independently creating 2 shared_ptrs that both own
the same memory location is a recipe for disaster.
There's always "shared_ptr<Foo> ptr_foo( new Foo );", which is less
typing than either anyways.
- Scott
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net