Хабр Курсы для всех
РЕКЛАМА
Большая витрина: от крупнейших школ до частных авторов. Сравнивайте по цене, длительности, формату и выбирайте самый подходящий курс!
that.handle = nullptr;Эээ… А разве понятие r-value reference не подразумевает константость that?
File(File&& that)
: handle(nullptr) {
*this = that;
}
File(File&& that) : handle(nullptr) { *this = std::move(that); }
std::vector<File> files;
File file("data1.txt");
files.push_back(std::move(file));
std::vector<File*> files;
File* file = new File("file1.txt");
files.push_back(file);
files.push_back(std::move(file));
[files addObject:file];
[file "doNotReferenceAnymoreTheFileObjectSoOwnershipWillTransferToThFilesObject"];
Move semantics в C++11 и STL-контейнеры