2009/2/25 Alexander <gutenev@gmail.com>
I am going to solve the same problem by replacing shared_ptr with a linked-list pointer. Each instance has pointers to two other so that all the instances pointing to the same object are linked in double linked loop. Size of such pointer is 3 times size of pointer (shared_ptr is only 2x pointer). This hardly can be done thread-safe without significant performance deradation. But it is easy to implement reset_all which changes all pointers that share the same ownership.

Common technique to reduce size of linked-list pointer is to use single linked list instead of double linked list. Copying such pointer is liner to the number of copies, but in cases where number of copies is low (i.e. in most cases) it's acceptable. The biggest advantage of linked-list pointers over shared_ptr is that they don't require additional allocation for a counter.

Roman Perepelitsa.