64,652
社区成员
发帖
与我相关
我的任务
分享
shared_ptr<Y> g (Y* pointer)
{
// here, (1) and (2) are satisfied, and you want (a) and (b), so shared_from_this is a must.
return pointer->f();
}
int main()
{
shared_ptr<Y> p(new Y);
g(p->get());
}