Commit 087f5273 authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook Github Bot

Fix evaluation-order assumption in futures varidic collect

Summary: [Folly] Fix evaluation-order assumption in futures varidic collect - argument evaluation order is unspecified so it must not be relied on when side-effects must occur in a specific order.

Reviewed By: lewissbaker

Differential Revision: D19347873

fbshipit-source-id: db4326d995a241619f96ff2bacdf5a5fa2332091
parent dbec7e74
...@@ -1348,13 +1348,13 @@ template <typename... Ts> ...@@ -1348,13 +1348,13 @@ template <typename... Ts>
void stealDeferredExecutorsVariadic( void stealDeferredExecutorsVariadic(
std::vector<futures::detail::DeferredWrapper>& executors, std::vector<futures::detail::DeferredWrapper>& executors,
Ts&... ts) { Ts&... ts) {
auto foreach = [&](auto& future) { foreach(
[&](auto, auto& future) {
if (auto executor = stealDeferredExecutor(future)) { if (auto executor = stealDeferredExecutor(future)) {
executors.push_back(std::move(executor)); executors.push_back(std::move(executor));
} }
return folly::unit; },
}; ts...);
[](...) {}(foreach(ts)...);
} }
template <class InputIterator> template <class InputIterator>
......
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