Boost logo

Boost :

Subject: Re: [boost] [move] explicit moving from a rvalue
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2012-03-26 16:41:18


Le 26/03/12 22:18, Ion Gaztañaga a écrit :
> El 26/03/2012 22:15, Ion Gaztañaga escribió:
>> El 26/03/2012 21:42, Vicente J. Botet Escriba escribió:
>>> Hi Ion,
>>>
>>> With the current emulation of move semantics of Boost.Thread using
>>> Boost.move, I have a case that I would like to make working in a
>>> portable way
>>>
>>> boost::thread t = boost::thread( MoveOnly());
>>>
>>> The library declares the template move constructor from a movable
>>> callable as as follows
>>>
>>> template <class F>
>>> explicit thread(boost::rv<F>& f);
>>
>> Why is the constructor explicit?
>
> Sorry, I replied too fast, thinking it was a plain move constructor. I
> see the need for it.
>
>> The problem is a know limitation as the compiler is unable to deduce
>> F as been MoveOnly even if MoveOnly is convertible to
>> boost::rv<MoveOnly>&
>> Jeffrey Lee Hellrung, Jr. made a proposal to try to solve the issue,
>> but his proposal has a performance penality.
>
> I just wonder if some kind of "always_inline" attribute for this
> proposal would fix the performance issue.
>
>
IIRC, the approach was based on type erasure, so I don't think that
inlining will help. Jerry?

Vicente


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