2013/6/1 Vicente J. Botet Escriba <vicente.botet@wanadoo.fr>

IMO boost::function doesn't supports move semantics. I will take a look at std::function. Could you post the error with std::function?


code:

#define BOOST_THREAD_VERSION 4

#include <boost/thread/future.hpp>
#include <functional>

int main()
{
  boost::packaged_task<void()> t1;

  std::function<void()> f2(boost::move(t1));
}

error:

1>------ Build started: Project: ConsoleApplication2, Configuration: Debug Win32 ------
1>  main.cpp
1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xrefwrap(317): error C2248: 'boost::packaged_task<<unnamed-symbol>>::packaged_task' : cannot access private member declared in class 'boost::packaged_task<<unnamed-symbol>>'
1>          with
1>          [
1>              <unnamed-symbol>=void (void)
1>          ]
1>          d:\devel\boost_1_54_0_beta1\boost\thread\future.hpp(2783) : see declaration of 'boost::packaged_task<<unnamed-symbol>>::packaged_task'
1>          with
1>          [
1>              <unnamed-symbol>=void (void)
1>          ]
1>          c:\program files (x86)\microsoft visual studio 11.0\vc\include\xrefwrap(404) : see reference to function template instantiation 'std::_Callable_base<_Ty,_Indirect>::_Callable_base<_Ty&>(_Ty2)' being compiled
1>          with
1>          [
1>              _Ty=boost::packaged_task<void (void)>,
1>              _Indirect=false,
1>              _Ty2=boost::packaged_task<void (void)> &
1>          ]

I initially though behavior was different when using boost::move() and std::move() to move t1 but boost::move actually is std::move on C++11 compiler. Hope this helps.

Cheers,
Simon