C++11 packaged_task<> with reference arg

M. Manfred mx2927@gmail.com
Fri Dec 11 16:59:00 GMT 2015



On 12/11/2015 05:17 PM, Jonathan Wakely wrote:
> That's how std::thread works. You need to use std::ref to pass by reference.
>
> The most recent explanation I've given is at
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68784
>

I am also somehow surprised about the real need for rvalue reference 
forwarding for the arguments (unlike for the function object itself - my 
reasoning too is that the programmer should know when to use 
references), but you are right that this is about the standard.

Thanks a lot for your reply.



More information about the Gcc-help mailing list