
Igor R
OTOH, intrusive_ptr doesn't have a weak_ptr counterpart -- and this is much more problematic, imho.
Yes that's an important feature too, but the ctor case is also a common case (e.g. solvable by adding an extra static 'Create'). To my knowledge the following drawbacks exist for shared_ptr: - you cannot use enabled_shared_from_this in the constructor. - you cannot use shared_ptr's in the destructor. - (never make a new shared_ptr family to an already shared object). - (enabled_shared_from_this only usable if the object is created as shared_ptr, not on the stack or just on the heap). The shared_ptr in dtor sounds as a 'contradictio in terminis'. A common case is that you have a change manager in which you want to de-register yourself in a dtor. The changemanager has ofc weak_ptr's to the managed object.