HPX - High Performance ParalleX

PrevUpHomeNext

Function template when_all

hpx::when_all

Synopsis

// In header: <hpx/lcos/when_all.hpp>


template<typename InputIter> 
  future< vector< future< typename std::iterator_traits< InputIter >::value_type > > > 
  when_all(InputIter first, InputIter last);

Description

The function when_all is an operator allowing to join on the result of all given futures. It AND-composes all future objects given and returns a new future object representing the same list of futures after they finished executing.

[Note] Note

Calling this version of when_all where first == last, returns a future with an empty vector that is immediately ready. Each future and shared_future is waited upon and then copied into the collection of the output (returned) future, maintaining the order of the futures in the input collection. The future returned by when_all will not throw an exception, but the futures held in the output collection may.

Parameters:

first

[in] The iterator pointing to the first element of a sequence of future or shared_future objects for which when_all should wait.

last

[in] The iterator pointing to the last element of a sequence of future or shared_future objects for which when_all should wait.

Returns:

Returns a future holding the same list of futures as has been passed to when_all.

  • future<vector<future<R>>>: If the input cardinality is unknown at compile time and the futures are all of the same type. The order of the futures in the output vector will be the same as given by the input iterator.


PrevUpHomeNext