On Mon, Apr 9, 2012 at 3:14 PM, Vicente
J. Botet Escriba
<vicente.botet@wanadoo.fr>
wrote:
There are yet some
problems on the Boost.Thread implementation or with the
compilers implementation.
When I want to pass functor, as in
A a(5);
boost::packaged_task<int> pt(a);
the constructor used is packaged_task(F&& f) and I
will expect packaged_task(F const& f) to be use for.
Are my expectations correct?
Well...no, apparently your expectations are not correct. But
that's slightly beside the point. I think the correct fix here
is to remove the packaged_task(F const &) overload
entirely, since the packaged_task(F&&) overload
already covers it (that's part of the entire design of
"templated rvalue references", to capture both rvalues *and*
lvalues). Then instantiate task_object with something like
remove_cv< remove_reference<F>::type >::type, and
use boost::forward<F>(f) to pass the function object
down to the task_object constructor.