问题描述
尝试更多使用rightvalues,但我感到困惑,如何设计要使用正确值的函数:
// Pass by whatever-it's-called
void RockyBalboa::DoSomething(std::string&& str){
m_fighters.push_back(str);
}
// Pass by reference
void RockyBalboa::DoSomething(std::string& str){
m_fighters.push_back(std::move(str));
}
这两个函数调用之间的有效区别是什么?当我用双符号& 并使用std::move
传递它时会发生什么?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)