| 272 | |
| 273 | template <typename T> |
| 274 | inline Future<std::vector<T>> collect( |
| 275 | const std::vector<Future<T>>& futures) |
| 276 | { |
| 277 | if (futures.empty()) { |
| 278 | return std::vector<T>(); |
| 279 | } |
| 280 | |
| 281 | Promise<std::vector<T>>* promise = new Promise<std::vector<T>>(); |
| 282 | Future<std::vector<T>> future = promise->future(); |
| 283 | spawn(new internal::CollectProcess<T>(futures, promise), true); |
| 284 | return future; |
| 285 | } |
| 286 | |
| 287 | |
| 288 | template <typename... Ts> |