加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

替换为C 17中删除的bind1st

发布时间:2020-12-16 10:14:59 所属栏目:百科 来源:网络整理
导读:我有这个bind1st的用法,但我将项目升级到C 17,因为bind1st被删除了. 如何在以下语句中替换bind1st? LAMBDA? DBManager::Instance().FuncQuery(std::bind1st(std::mem_fn(CGuild::LoadGuildData),this),"SELECT master,level,exp,name,skill_point,skill,sp
我有这个bind1st的用法,但我将项目升级到C 17,因为bind1st被删除了.

如何在以下语句中替换bind1st?
LAMBDA?

DBManager::Instance().FuncQuery(std::bind1st(std::mem_fn(&CGuild::LoadGuildData),this),"SELECT master,level,exp,name,skill_point,skill,sp,ladder_point,win,draw,loss,gold FROM guild WHERE id = %u",m_data.guild_id);

解决方法

只需使用 std::bind:

std::bind(std::mem_fn(&CGuild::LoadGuildData),this,std::placeholders::_1)

你也可以删除多余的std :: mem_fn:

std::bind(&CGuild::LoadGuildData,std::placeholders::_1)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读