
15 Oct
2004
15 Oct
'04
11:21 p.m.
On 10/14/2004 09:52 AM, Oleg Fedtchenko wrote: [snip]
we must specify an owner every time and easily can pass in a shared_ptr other than pointing to the right owner:
shared_ptr<A> pA(new A);
shared_ptr<SOME> pSome(new SOME);
shared_ptr<B> pB = pA->GetB( pSome);
Could you define a new shared_ptr templated CTOR which takes a pointer to member: template<typename Member> struct shared_ptr { template<typename Owner, Member Owner::*pm_type> shared_ptr(shared_ptr<Owner>* a_owner, pm_type a_pm) : px(a_owner.get()->a_pm), pn(???) {} }; I haven't compiled this; hence, the syntax may not be right. How would this compare with member_ptr, and the others?