From: Valentin Samko (boost_at_[hidden])
Date: 2006-04-12 15:13:55
UE> - Size of the shared_ptr object itself is two pointers.
UE> - One additional allocation overhead for shared count, weak count and deleter
UE> function pointer (I'm just guessing, is that right?) Further, size is how
UE> much? Does it have a specially adapted allocator for those?
UE> - Additional freedom with custom deleters.
UE> - Allows various type conversions (like raw pointers), including to void or
UE> other incomplete types.
UE> - Allows weak references (i.e. observers rather than owners) via weak_ptr.
UE> - Can be constructed from auto_ptr.
UE> - Can be retrieved via 'this', but this requires additional overhead
UE> (enable_shared_from_this) in the object itself.
I would add that shared_ptr can be safely passed between dll's which
have different heaps as shared_ptr contains a custom deleter. This is
a very important feature.