
18 Nov
2004
18 Nov
'04
12:24 p.m.
Gennadiy Rozental wrote:
Let say we have somewhere map<T*,shared_ptr<T>*> registry;
if( registry[raw_ptr] == 0 ) { t = shared_ptr<T>( raw_ptr ) registry.add( raw_ptr, &t ); } else t = *registry[raw_ptr];
}
Do I miss something important?
The problem is that a shared_ptr<T> and a shared_ptr<U> can share ownership, and that they both can actually contain a V, derived from T and U.