Boost logo

Boost :

Subject: Re: [boost] [future William proposal] packaged_task do notacceptboost::ref of a nullary functor
From: vicente.botet (vicente.botet_at_[hidden])
Date: 2009-01-05 12:26:22


----- Original Message -----
From: "Anthony Williams" <anthony.ajw_at_[hidden]>
To: <boost_at_[hidden]>
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_at_[hidden]> writes:
>
>> From: "vicente.botet" <vicente.botet_at_[hidden]>
>
>>> 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


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk