![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++语言学习
文章平均质量分 91
逆天小神健
人间不值得
展开
-
std::move和std::forward 深度剖析
1 引入的规则规则1(引用折叠规则):如果间接的创建一个引用的引用,则这些引用就会“折叠”。一般情况下,引用折叠成一个普通的左值引用类型。X& &、X& &&、X&& &都折叠成X&一种特殊情况下,引用会折叠成右值引用,即右值引用的右值引用, T&& &&。X&& &&折叠为X&&规则2(右值引用的特殊类型推断规则):当将转载 2021-08-05 10:53:40 · 554 阅读 · 0 评论 -
std::move使用不当引起的copy elision
在使用sonarqube检测C++项目代码时,发现一个使用std::move引起的code smell等级的告警,特记录。原文内容:Usually, when copying an object, the source object is unchanged, which means that all resources owned by the source objects have to be duplicated during the copy operation. In the case原创 2021-05-07 22:29:08 · 3795 阅读 · 0 评论