|
Boost : |
Subject: Re: [boost] Boost.Fiber review January 6-15
From: Agustín K-ballo Bergé (kaballo86_at_[hidden])
Date: 2014-01-22 14:11:35
On 22/01/2014 03:54 p.m., Vicente J. Botet Escriba wrote:
> Le 22/01/14 17:07, Nat Goodspeed a écrit :
>> On Wed, Jan 22, 2014 at 7:30 AM, Vicente J. Botet Escriba
>> <vicente.botet_at_[hidden]> wrote:
>>
>>> Le 22/01/14 03:39, Nat Goodspeed a écrit :
>>>> In my (obviously incomplete) mental model, a
>>>> hypothetical fiber constructor:
>>>>
>>>> fiber f(some_callable, 3.14, "a string", 17);
>>>>
>>>> would be completely equivalent to:
>>>>
>>>> fiber f(bind(some_callable, 3.14, "a string", 17));
>>>>
>>>> What am I missing? (If this is already well-explained elsewhere, I
>>>> would appreciate a pointer as much as your own explanation.)
>>> boost::bind is not movable :( or is it in C++11?)
>> I haven't yet read Agustín's links -- but I will, thank you!
>>
>> Since movable-only callables are clearly an important use case, I
>> would hope that if (let's say) std::bind is not yet itself movable,
>> that's a transient situation which will soon be remedied.
> I think that std::bind is movable.
Yes, the forwarding call wrapper returned from `std::bind` is movable.
That doesn't change the fact that:
- Using `bind` in the implementation provides different semantics than
those required by the standard.
- Using `bind` either in the implementation or in the user code means
that arguments are not forwarded, thus movable-only types cannot be used
with a target callable taking them by value, and using copyable types
results in unnecessary copies.
Regards,
-- Agustín K-ballo Bergé.- http://talesofcpp.fusionfenix.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk