Jun's Blog

Recent content on Jun's Blog

马上订阅 Jun's Blog RSS 更新: https://www.junz.org/index.xml

C++ 移动语义基础

2023年2月21日 16:19
移动语义的作用 直接看一个例子: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 #include <iostream> struct S { S() { std::cout << "S()\n"; } S(const S&) { std::cout << "S(const S&)\n"; } ~S() { std::cout << "~S()\n"; } }; S foo() { return S(); } int main() { foo(); } 用以下