您的位置:首页 > Web前端

编译错误:error: invalid initialization of non-const reference of type ‘*&’ from a temporary of type

2017-04-27 09:54 781 查看
属于函数参数引用临时变量错误

解决方案:函数声明和定义中在该参数的类型前添加const关键字。

例:void test_func(string &str);

将其改为:void test_func(const string &str);

在该函数实现中的对应位置做同样的改动。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  函数
相关文章推荐