
28 Apr
2008
28 Apr
'08
1:27 p.m.
Daniel Frey:
Consider:
class Object { static map< string, shared_ptr< Object > > cache;
Object() { cache.insert( make_pair( "foo", shared_from_this() ) ); throw 42; } };
With the above BOOST_ASSERT(_shared_count.empty()), ::abort() seems to most sensible thing we can do, otherwise it would lead to very dangerous situations where cache contains a shared_ptr to a deleted object.
The original assert catches this case, does it not?