1 #include <iostream> 2 #include <thread> 3 using namespace std; 4 5 //交换线程,线程移动 6 void main() 7 { 8 thread t1([]() {cout << "hello" << endl; }); 9 thread t2([]() {cout << "hello3" << endl; }); 10 //交换线程 11 swap(t1, t2); 12 thread t3 = move(t1);//线程移动,t2具备t1的属性 13 cin.get(); 14 }