recentpopularlog in

kme : threads   8

c++ - Why does passing object reference arguments to thread function fails to compile? - Stack Overflow
Threads copy their arguments (think about it, that's The Right Thing). If you want a reference explicitly, you have to wrap it with std::ref (or std::cref for constant references):

std::thread t(foo, std::ref(std::cout));
threads  cplusplus  c++11  multithreading  solution 
december 2016 by kme

Copy this bookmark:





to read