
----- Original Message ----- From: "Anthony Williams" <anthony.ajw@gmail.com> To: <boost@lists.boost.org> Sent: Monday, January 05, 2009 12:49 PM Subject: Re: [boost] [future William proposal] packaged_task do notacceptboost::ref of a nullary functor
"vicente.botet" <vicente.botet@wanadoo.fr> writes:
From: "vicente.botet" <vicente.botet@wanadoo.fr>
packaged_task do not accept boost::ref to nullary functions while thread allows it. Shouldn't packaged_task > accept them? How can the user workaround this issue? How thread solved this issue?
I have found a workaround. Instead of boost::packaged_task<unsigned > tsk(boost::ref(f)); I use boost::packaged_task<unsigned> tsk(boost::bind(boost::ref(f)));
Is this the correct way?
That's essentially what Boost.Thread does.
Given the prototypes: template<typename F> explicit thread(F func); template <class F> explicit packaged_task(F const& f): Shouldn't the prototype of packaged_task be template <class F> explicit packaged_task(F f): Shouldn't boost::thread(boost::ref(f)); fail or boost::packaged_task<unsigned> tsk(boost::ref(f)); succeed? What is the reason to make them different? Best, Vicente