Commit 27a0093e authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook GitHub Bot

Add a missing forward in makeAsyncTask

Summary:
[Folly] Add a missing `std::forward` in `makeAsyncTask`.

As a matter of policy in folly futures, continuations are invoked with the cv-ref qualifiers (excluding v qualifiers) with which they are passed. Here is a case where the policy was not upheld.

Reviewed By: ericniebler

Differential Revision: D22672148

fbshipit-source-id: b8dba221914221d390617fa1c69736c5c547e40c
parent 85009b3f
...@@ -2014,15 +2014,15 @@ std::pair<Promise<T>, Future<T>> makePromiseContract(Executor::KeepAlive<> e) { ...@@ -2014,15 +2014,15 @@ std::pair<Promise<T>, Future<T>> makePromiseContract(Executor::KeepAlive<> e) {
template <class F> template <class F>
auto makeAsyncTask(folly::Executor::KeepAlive<> ka, F&& func) { auto makeAsyncTask(folly::Executor::KeepAlive<> ka, F&& func) {
return return [func = std::forward<F>(func),
[func = std::forward<F>(func), ka = std::move(ka)](auto&& param) mutable { ka = std::move(ka)](auto&& param) mutable {
return via( return via(
ka, ka,
[func = std::move(func), [func = std::move(func),
param = std::forward<decltype(param)>(param)]() mutable { param = std::forward<decltype(param)>(param)]() mutable {
return func(std::forward<decltype(param)>(param)); return std::forward<F>(func)(std::forward<decltype(param)>(param));
}); });
}; };
} }
/// This namespace is for utility functions that would usually be static /// This namespace is for utility functions that would usually be static
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment