https://www.bookstack.cn/read/Cpp_Concurrency_In_Action/content-chapter3-3.1-chinese.md
#include
#include //①
#include
#include//for_each头文件
#include//mem_fn头文件
void hello(int &i, std::string const& s) //②
{i&#61;3;std::cout <}
void do_work(int id)
{std::cout<}
int main()
{/* int x&#61;4;std::thread t(hello,std::ref(x),"try"); //③//t.join(); //④t.detach();std::cout<<"----"< threads;for(int i&#61;0; i <20; &#43;&#43;i){threads.push_back(std::thread(do_work,i)); // 产生线程}std::for_each(threads.begin(),threads.end(),std::mem_fn(&std::thread::join)); // 对每个线程调用join()}