We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cout << "pass by value: " << endl; AcceptVal(ReturnRvalue()); // 应该调用两次拷贝构造函数 cout << "pass by reference: " << endl; AcceptRef(ReturnRvalue()); // 应该只调用一次拷贝构造函数
如果允许的话,是没有Copy的,是因为C++ RVO (Return Value Optimization),详细在https://stackoverflow.com/questions/10476665/avoiding-copy-of-objects-with-the-return-statement
我是用VS跑的
The text was updated successfully, but these errors were encountered:
Sorry, something went wrong.
No branches or pull requests
cout << "pass by value: " << endl;
AcceptVal(ReturnRvalue()); // 应该调用两次拷贝构造函数
cout << "pass by reference: " << endl;
AcceptRef(ReturnRvalue()); // 应该只调用一次拷贝构造函数
如果允许的话,是没有Copy的,是因为C++ RVO (Return Value Optimization),详细在https://stackoverflow.com/questions/10476665/avoiding-copy-of-objects-with-the-return-statement
我是用VS跑的
The text was updated successfully, but these errors were encountered: