【发布时间】:2011-05-23 13:20:50
【问题描述】:
这能正常工作吗? (见例子)
unique_ptr<A> source()
{
return unique_ptr<A>(new A);
}
void doSomething(A &a)
{
// ...
}
void test()
{
doSomething(*source().get()); // unsafe?
// When does the returned unique_ptr go out of scope?
}
【问题讨论】:
标签: c++ unique-ptr