轉移線程的所有權

std::thread和std::unique_ptr,std::fstream、std::ifstream、std::ofstream等流一樣只可轉移move所有權,不可複製copy。

#include <thread>
#include <utility>  // std::move
#include <iostream>

void Foo() {
    std::cout << "foo" <<
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章