阅读背景:

如何将unique_ptr捕获到lambda表达式中?

来源:互联网 

I have tried the following:

我试过以下方法:

std::function<void ()> getAction(std::unique_ptr<MyClass> &&psomething){
    //The caller given ownership of psomething
    return [psomething](){ 
        psomething->do_some_thing();
        //psomething is expected to be released after this point
    };
}
std::f



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: