C++, std::move

送分小仙女□ 提交于 2020-01-21 01:10:07

0.

std::move is used to indicate that an object may be "removed from", allowing the efficient transfer of resources from t to another object. 

1. Examples:

#include <utility>

string str = "hello";
string str2 = std::move(str);    // transfer and str2 is "hello"
cout << str << endl;    // str is empty now

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!