$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-users] [shared_ptr] deleter that destroys shared_ptr - is it safe?
From: Igor R (boost.lists_at_[hidden])
Date: 2009-09-08 17:28:21
Hello,
Is the following code legal and safe -
a) according to the shared_ptr specs
b) with the current boost::shared_ptr implementation
Thanks!
struct a
{
a() : p_(this, mem_fn(&a::delete_me))
{}
void reset()
{
p_.reset();
}
void delete_me()
{
delete this;
}
shared_ptr<a> p_;
};
int main()
{
a* p = new a;
p->reset();
}