
hello all I hope this is not a stupid question. Suppose I have a shared_ptr which is the only owner of the pointee. I hope there is a way to hand over its ownership to another object without rendering the pointee being deleted. Or, if the answer is no, is there an alternative class that has this feature? The use case is like this: B b; { shared_ptr p1(A()), p2(A()); b.GetOwnership(p1.HandOver()); // now p1 is empty } // p2 is deleted here // but the A obj p1 used to be pointing to // has been handed over to b and is still // alive here b.DestroyA(); // the A obj holded by b is destroyed by b // explicitly Thanks in advance B/Rgds Max ------------------------------------------------------------------- 新浪空间——与朋友开心分享网络新生活!(http://space.sina.com.cn/ )