Boost logo

Boost :

From: Rani Sharoni (rani_sharoni_at_[hidden])
Date: 2003-12-11 09:46:59

Peter Dimov wrote:
> Have you read

Thanks for this awesome usability demonstration!
Maybe it will help me to convince some people in my work place to start
using shared_ptr.

I have few comments regarding failure guaranties. In general I think that
weakening failure guarantee is something that should be avoided and I saw
few places in your paper in which adding shared_ptr changed the failure
guarantee from no-fail into fail with std::bad_alloc since share_ptr
constructor might throw it.

For example:
1) Using shared_ptr as CopyConstructible mutex lock: lock had no fail
2) Using shared_ptr to wrap member function calls: operator-> might have no
fail guarantee. E.g. pointer<X> p; p->cleanup();
3) Delayed deallocation: Y::f() called px.reset that had no fail and
vector::push_back might throw.

One question: why shared_count::shared_count(weak_count const &) throws
boost::bad_weak_ptr and what can be done when catching such exceptions? It
seems to have potential impact on the failure guaranty of many functions
such as impl::getX (Obtaining a shared_ptr to this).


Boost list run by bdawes at, gregod at, cpdaniel at, john at