
----- Original Message ----- From: "Steven Watanabe" <watanabesj@gmail.com> To: <boost@lists.boost.org> 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