|
Boost : |
From: David B. Held (dheld_at_[hidden])
Date: 2003-01-31 14:28:53
"David B. Held" <dheld_at_[hidden]> wrote in message
news:b1ehpj$j1n$1_at_main.gmane.org...
> [...]
> ~InitializerScopeGuard()
> { if (execute_) storage::release(); }
Oops!
~InitializerScopeGuard()
{ if (execute_) storage_.release(); }
Also, I don't need the extra layer of indirection. I could just
implement ref_counted directly, like so:
template <typename U>
ref_counted(std::auto_ptr<U>& p, InitializerScopeGuard guard)
: count_(new unsigned(1))
{
guard.cancel();
p.release();
}
smart_ptr(std::auto_ptr<U>& p)
: storage(p), ownership(p, InitializerScopeGuard(*this)),
checking(), conversion()
{ checking::on_init(p); }
Of course, the big question is whether it's valid to refer to 'this' for
a partially c'ted object, even if you only refer to the fully c'ted
portions.
Dave
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk