|
Boost : |
Subject: Re: [boost] [Review] Formal Review: Boost.Move
From: vicente.botet (vicente.botet_at_[hidden])
Date: 2010-05-26 10:13:09
----- Original Message -----
From: "Ion Gaztañaga" <igaztanaga_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Wednesday, May 26, 2010 2:08 PM
Subject: Re: [boost] [Review] Formal Review: Boost.Move
>
> On 26/05/2010 13:46, vicente.botet wrote:
>> Hi,
>>
>> The following doesn't compiles.
>> void fct(BOOST_RVALUE_REF(movable_only) mo, int x){...}
>> ...
>> movable_only m;
>> boost::function<void()> f_one = boost::bind(&fct, boost::move(m), 1);
>>
>> Im not sure if the following is correct,
>> boost::function<void()> f_one = boost::bind(&fct, boost::ref(boost::move(m)), 1);
>>
>> What is the correct way to use move semantics with Boost.Bind? Do we need some Boost.Bind adaptations?
>
> I don't know, maybe Boost.Bind should catch rvalues differently, but
> like with perfect forwarding (after all, bind is about forwarding) we'll
> need some limitations or tweaks. Maybe we need some
> ::boost::rv_ref()/boost::rv_reference_wrapper in Boost.Ref to pass
> rvalues to bind. And them Bind could forward them to the target call.
> Bind documentation says:
<snip>
> So evidently we can't pass movable-only objects unless we have some
> rvalue reference wrapper.
Can ::boost::rv_ref()/boost::rv_reference_wrapper be implemented without using boost::rv?
If not, is this one reason to make it public and documented?
Best,
Vicente
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk