boost :: scoped线程是否自动分离或必须手动分离。
#include <boost/thread.hpp>
#include <boost/thread/scoped_thread.hpp>
#include <iostream>
void thread()
{
for (int i = 0; i != 10000; ++i)
{
std::cout << i << std::endl;
}
}
int main()
{
boost::scoped_thread<> t{boost::thread{thread}};
// Do I need t.detach() here
// Some code from main function
return EXIT_SUCCESS;
}