HPX - High Performance ParalleX

PrevUpHomeNext

Function template when_any

hpx::when_any

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(InputIter first, InputIter last);

Description

The function when_any 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.

Parameters:

first

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

last

[in] The iterator pointing to the last element of a sequence of future or shared_future objects for which when_any 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