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

posted @ 2020-01-21 00:42  心怀阳光  阅读(119)  评论(0编辑  收藏  举报