new std::thread()
时间: 2023-08-19 08:16:30 浏览: 152
回答: 在C++中,使用`new std::thread()`创建一个新的std::thread对象是不被推荐的做法。因为std::thread的实例是可移动但不可复制的,所以不能通过赋值操作来舍弃之前的关联线程。正确的做法是直接使用std::thread的构造函数来创建一个新的std::thread对象,例如`std::thread t(test);`。\[1\]\[2\]
#### 引用[.reference_title]
- *1* *2* [C++ std::thread初步了解](https://blog.csdn.net/gongjianbo1992/article/details/99209119)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [C++11多线程std::thread](https://blog.csdn.net/qq445803843/article/details/95589858)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文