$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
From: Christian Larsen (contact_at_[hidden])
Date: 2007-09-10 14:09:24
Alessandro Re wrote:
> Hi,
> can please someone explain me why in boost's smart pointers (and also
> in auto_ptr, if there is a reason), there is no operator=(T *)?
> Shouldn't it work like reset()?
Having e.g. a shared_ptr::operator=(T *) would be dangerous, as the
shared_ptr would take over the ownership of the pointer and hence delete it
when it's no longer referenced, and that may not be what you wanted.
Therefore you have to say so explicitly, if that's what you're after, just
use reset().
Best regards,
Christian Larsen