
Hi, I attached a complete implementation of enable_shared_from_this_light which has an overhead of a single plain pointer. It is compatible with 1.35.0's enable_shared_from_this, except for one feature: The optimized version requires that the following static_cast is legal: enable_shared_from_this_light<T>* p; static_cast<T*>(p); which means that enable_shared_from_this_light<T> must be a *non-virtual* base class of T. If you need this feature, you might want to use trunk's enable_shared_from_this (without _light), which (currently) has an overhead of four plain pointers, one bool and it adds/requires the class to have a vtable. The trunk version therefore offers some advanced features. The above repeats a few things for those people that haven't followed the discussion in the "[smart_ptr] Some questions"-thread. For those that did: The thing to note is that I added two more things to shared_ptr: _internal_shared_count() and a ctor which takes a detail::weak_count and the raw pointer. Any feedback welcome. Regards, Daniel