HPX - High Performance ParalleX

PrevUpHomeNext

Function template when_all_n

hpx::when_all_n

Synopsis

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


template<typename InputIter> 
  future< vector< future< typename std::iterator_traits< InputIter >::value_type > > > 
  when_all_n(InputIter begin, std::size_t count);

Description

The function when_all_n 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

As long as ec is not pre-initialized to hpx::throws this function doesn't throw but returns the result code using the parameter ec. Otherwise it throws an instance of hpx::exception.

None of the futures in the input sequence are invalidated.

Parameters:

begin

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

count

[in] The number of elements in the sequence starting at first.

Returns:

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

  • 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.

Throws:

This function will throw errors which are encountered while setting up the requested operation only. Errors encountered while executing the operations delivering the results to be stored in the futures are reported through the futures themselves.

PrevUpHomeNext