HPX - High Performance ParalleX

PrevUpHomeNext

Function template when_any_n

hpx::when_any_n

Synopsis

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


template<typename InputIter> 
  future< when_any_result< vector< future< typename std::iterator_traits< InputIter >::value_type > > > > 
  when_any_n(InputIter first, std::size_t count);

Description

The function when_any_n is a non-deterministic choice operator. It OR-composes all future objects given and returns a new future object representing the same list of futures after one future of that list finishes execution.

[Note] Note

None of the futures in the input sequence are invalidated.

Parameters:

count

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

first

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

Returns:

Returns a when_any_result holding the same list of futures as has been passed to when_any and an index pointing to a ready future.

  • future<when_any_result<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