摘要: 返回值优化(return value optimization, RVO)是一种减少开销的行为 下面一段代码定义了一个结构体,用于显示返回值优化的效果 static int counter; // counter to identify instances of S struct S { int i 阅读全文
posted @ 2022-05-31 16:54 yuzuki_n 阅读(313) 评论(0) 推荐(0)
摘要: 知识点非常简单,直接看代码 struct Person { int age; std::string name; }; int main() { std::vector<Person> v{{10, "Tom"}, {20, "lily"}}; for (const auto &[age, name 阅读全文
posted @ 2022-05-31 12:08 yuzuki_n 阅读(58) 评论(0) 推荐(0)