C++, std::move

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

猜你喜欢

转载自www.cnblogs.com/sarah-zhang/p/12219961.html