Problem with 'future' on compiler without move semantics
In my earlier note, I figured it should just work. But it's not.
I think it might be different on Boost 1.47?
Can anyone give me a VERY QUICK answer on how to return a unique_future on a compiler
without && using Boost 1.47?
Thanks!
—John
In file included from
/Volumes/VSee_Source/svnTree/Trunk/stable/Testing/UnitTests/Tools/threadpoolTest.cpp:2:
⋯: error: calling a private constructor of class 'boost::unique_future<int>'
return future_result; // built-in mover via implicit conversions
^
/⋯lTest.cpp:61:30: note: in instantiation of function template specialization
'vst::async
On Thu, Apr 12, 2012 at 4:26 PM, John M. Dlugosz
In my earlier note, I figured it should just work. But it's not. I think it might be different on Boost 1.47?
Can anyone give me a VERY QUICK answer on how to return a unique_future on a compiler without && using Boost 1.47?
compiler?
Thanks! —John
In file included from /Volumes/VSee_Source/svnTree/**Trunk/stable/Testing/ **UnitTests/Tools/**threadpoolTest.cpp:2:
⋯: error: calling a private constructor of class 'boost::unique_future<int>'
return future_result; // built-in mover via implicit conversions
Try return boost::move(future_result);
^
/⋯lTest.cpp:61:30: note: in instantiation of function template specialization 'vst::async
' requested here vst::unique_future<int> fi= vst::async (&calculate_the_answer_to_** life_the_universe_and_**everything);
^
/opt/local/include/boost/**thread/future.hpp:619:9: note: implicitly declared private here
unique_future(unique_future & rhs);// = delete;
^
- Jeff
On Thu, Apr 12, 2012 at 5:37 PM, Jeffrey Lee Hellrung, Jr. < jeffrey.hellrung@gmail.com> wrote:
On Thu, Apr 12, 2012 at 4:26 PM, John M. Dlugosz
wrote: In my earlier note, I figured it should just work. But it's not. I think it might be different on Boost 1.47?
Can anyone give me a VERY QUICK answer on how to return a unique_future on a compiler without && using Boost 1.47?
compiler?
Sorry, I meant "which compiler?".
Thanks! —John
In file included from /Volumes/VSee_Source/svnTree/** Trunk/stable/Testing/**UnitTests/Tools/**threadpoolTest.cpp:2:
⋯: error: calling a private constructor of class 'boost::unique_future<int>'
return future_result; // built-in mover via implicit conversions
Try
return boost::move(future_result);
Also, I'm pretty sure you'd need this regardless of the presence of (true) rvalue references.
^
/⋯lTest.cpp:61:30: note: in instantiation of function template specialization 'vst::async
' requested here vst::unique_future<int> fi= vst::async (&calculate_the_answer_to_* *life_the_universe_and_**everything);
^
/opt/local/include/boost/**thread/future.hpp:619:9: note: implicitly declared private here
unique_future(unique_future & rhs);// = delete;
^
- Jeff
On 4/12/2012 7:40 PM, Jeffrey Lee Hellrung, Jr. wrote:
Try
return boost::move(future_result);
Also, I'm pretty sure you'd need this regardless of the presence of (true) rvalue references.
Actually, I'm writing: #ifdef BOOST_NO_RVALUE_REFERENCES return future_result; // built-in mover via implicit conversions #else return std::move(future_result); #endif boost::move was not available with 1.47, but std::move must be if rvalue refs are available. —John
On 4/12/2012 7:37 PM, Jeffrey Lee Hellrung, Jr. wrote:
compiler?
Clang on Apple, not sure of the version other than that I don't think it's the very latest.
Try
return boost::move(future_result);
No, I actually had to replace boost::move with std::move to compile on VS10 (which has std::move) and Boost 1.47 (which doesn't have boost::move it seems. Introduced in 1.48?) —John
Le 13/04/12 01:26, John M. Dlugosz a écrit :
In my earlier note, I figured it should just work. But it's not. I think it might be different on Boost 1.47?
Can anyone give me a VERY QUICK answer on how to return a unique_future on a compiler without && using Boost 1.47?
Can you try an undocumented function
operator boost::detail::thread_move_t
On Thu, Apr 12, 2012 at 5:38 PM, Vicente J. Botet Escriba < vicente.botet@wanadoo.fr> wrote:
Le 13/04/12 01:26, John M. Dlugosz a écrit :
In my earlier note, I figured it should just work. But it's not. I think it might be different on Boost 1.47?
Can anyone give me a VERY QUICK answer on how to return a unique_future on a compiler without && using Boost 1.47?
Can you try an undocumented function
operator boost::detail::thread_move_t<**unique_future>() { return boost::detail::thread_move_t<**unique_future>(*this); }
unique_future<int> bar() { return boost::detail::thread_move_t<**unique_future<int>>(foo())); }
Please don't forget to post the exact example, the boost version, the compiler, ...
Ack, my mistake, John; I don't believe Boost.Move had been included in Boost by 1.47 yet, so my suggestion in an earlier message wouldn't work. Best to follow Vicente's advice here... Sorry for the noise, - Jeff
participants (3)
-
Jeffrey Lee Hellrung, Jr.
-
John M. Dlugosz
-
Vicente J. Botet Escriba