Boost logo

Boost :

Subject: Re: [boost] Design conventions; passing functors
From: vicente.botet (vicente.botet_at_[hidden])
Date: 2008-11-15 19:44:09


----- Original Message -----
From: "Steven Watanabe" <watanabesj_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Saturday, November 15, 2008 11:44 PM
Subject: Re: [boost] Design conventions; passing functors

>
> AMDG
>
> vicente.botet wrote:
>>>> it is always
>>>> possible to create another function object that just
>>>> stores a reference to the original function object.
>>>>
>>
>> Is not this the role of boost::ref?
>>
>
> std::ref provides a forwarding operator(). boost::ref does not.

Thanks Steven to pointing it out. Do you know why boost::ref does not? Do the author of boost.ref plan to provides the forwarding operator()?

Could someone explain me how this works for the Boost.Thread library? >From the Boost.Thread documentation

"Launching threads
A new thread is launched by passing an object of a callable type that can be invoked with no parameters to the constructor. The object is then copied into internal storage, and invoked on the newly-created thread of execution. If the object must not (or cannot) be copied, then boost::ref can be used to pass in a reference to the function object. In this case, the user of Boost.Thread must ensure that the referred-to object outlives the newly-created thread of execution. "

Take in account that Boost.Thread do some kind of move semantics emulation.

Thanks in advance,

Vicente


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