|
Boost Users : |
Subject: Re: [Boost-users] unique_future without rvalue references
From: John M. Dlugosz (mpbecey7gu_at_[hidden])
Date: 2012-05-16 14:17:01
On 5/16/2012 3:45 AM, Vicente J. Botet Escriba wrote:
> have you tried with
>
> boost::unique_future<T> f() {
> /// x
> return boost::detail::thread_move_t<T>(x);
> }
>
Writing it as two lines,
boost::detail::thread_move_t<T> shuttle (x);
return shuttle;
it's clear that the error is with the return statement. It insists that the copy
constructor is callable, even though in reality it is optimized out. That is what the
standard says. Perhaps other compilers ignore that fine print.
Yet, packaged_task::get_future seems to be able to return just fine.
Writing it as:
boost::detail::thread_move_t<unique_future<RetType> > shuttle (future_result);
return unique_future<RetType>(shuttle);
seems to work! Yea! Odd, I had tried the explicit construct around the operator all on
one line yesterday, and it didn't help.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net