c++ 绑定成功,lambda SEGV

问题描述

好的,请打我的头。我不明白 lambda 表达式怎么样?

为什么下面的注释中的 std::bind 工作正常,而 Lamba 表达式在运行时消失并崩溃?

如何让他们早上留下来吃鸡蛋和咖啡?

    wrapper->setPoweredAttribute(true,// using bind works fine
        //
        //std::bind(&BluetoothStateImpl::cb,this,std::placeholders::_1,evt.cb,//    "BtOff_tryPowerOn",//    [bst](){ bst->powerOn(); })); 
           
        // but below crashes on first line 
        //    
        [this,&evt,bst](connectivity::types::CommandResults x) 
        { 
            cb(x,"BtOff_tryPowerOn",// <-- SEGV here!!
                [bst](){ bst->powerOn(); }); 
        });  

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)