While reading about multithreading in C++11, I noticed that some tutorials do this:
std::thread(print_message, "Hello").detach();
// instead of...
std::thread t(print_message, "Hello");
t.detach();
My questions are:
- In general, is it safe to call non-const member functions for temporary (rvalue) objects?
- In particular, is it safe to do so for a C++11
std::thread
?