void foo(){
for(int i = 0; i < 5; i++){
cout << "cout " << i << endl;
}
}
int main() {
thread t(foo);
t.detach();
assert(!t.joinable());
std::cout << "Hello, World!" << std::endl;
return 0;
}
Hello, World!cout
0
cout 1cout 1
cout 2
c