|
Boost : |
Subject: Re: [boost] Boost.Fiber mini-review September 4-13
From: AgustÃn K-ballo Bergé (kaballo86_at_[hidden])
Date: 2015-09-07 16:58:29
On 9/7/2015 5:42 PM, Nat Goodspeed wrote:
> On Mon, Sep 7, 2015 at 4:28 PM, AgustÃn K-ballo Bergé
> <kaballo86_at_[hidden]> wrote:
>
>> `fiber::async` signature is still wrong. Note this was a C++11 defect:
>>
>> http://cplusplus.github.io/LWG/lwg-defects.html#2021
>
> So to be clear, I think you are requesting this instead?
>
> template< typename Fn, typename ... Args >
> future< typename std::result_of< typename
> std::decay<Fn>::type(typename std::decay<Args>::type... ) >::type >
> async( Fn && fn, Args && ... args) { ... }
>
> (making the corresponding future<> type change in both overloads of course)
That's the signature fix, yes. It appears the implementation already
decay-copies the arguments correctly. But since you had me double check:
- The result paragraph reads "future< typename result_of< Fn >::type >
representing the shared state associated with the asynchronous execution
of fn.", that's wrong too.
- The implementation of `invoke_helper` looks weird:
https://github.com/olk/boost-fiber/blob/master/include/boost/fiber/detail/invoke.hpp#L42-L48.
`std::get< I >( std::forward< Tpl >( tpl) )` should suffice.
- The implementation of `async` moves a local future while returning it.
This is an anti-pattern, since it prevents elision.
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