/*
- * Copyright 2017 Facebook, Inc.
+ * Copyright 2014-present Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
await([first, last, context](Promise<void> promise) mutable {
context->promise = std::move(promise);
for (size_t i = 0; first != last; ++i, ++first) {
-#ifdef __clang__
-#pragma clang diagnostic push // ignore generalized lambda capture warning
-#pragma clang diagnostic ignored "-Wc++1y-extensions"
-#endif
addTask([ i, context, f = std::move(*first) ]() {
try {
auto result = f();
context->promise->setValue();
}
});
-#ifdef __clang__
-#pragma clang diagnostic pop
-#endif
}
});
await([first, last, context](Promise<void> promise) mutable {
context->promise = std::move(promise);
for (size_t i = 0; first != last; ++i, ++first) {
-#ifdef __clang__
-#pragma clang diagnostic push // ignore generalized lambda capture warning
-#pragma clang diagnostic ignored "-Wc++1y-extensions"
-#endif
addTask([ i, context, f = std::move(*first) ]() {
try {
f();
context->promise->setValue();
}
});
-#ifdef __clang__
-#pragma clang diagnostic pop
-#endif
}
});
type> inline collectAll(InputIterator first, InputIterator last) {
typedef typename std::result_of<
typename std::iterator_traits<InputIterator>::value_type()>::type Result;
- size_t n = std::distance(first, last);
+ size_t n = size_t(std::distance(first, last));
std::vector<Result> results;
std::vector<size_t> order(n);
results.reserve(n);
assert(result.size() == 1);
return std::move(result[0]);
}
-}
-}
+} // namespace fibers
+} // namespace folly