HPX - High Performance ParalleX


Function template inverse_fold_with_index

hpx::lcos::inverse_fold_with_index — Perform a distributed inverse folding operation.


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

template<typename Action, typename FoldOp, typename Init, typename ArgN, ... > 
  hpx::unique_future< decltype(Action(hpx::id_type, ArgN,..., std::size_t))> 
  inverse_fold_with_index(std::vector< hpx::id_type > const & ids, 
                          FoldOp && fold_op, Init && init, ArgN argN, ...);


The function hpx::lcos::inverse_fold_with_index performs an inverse distributed folding operation over results returned from action invocations on a given set of global identifiers. The action can be either plain action (in which case the global identifiers have to refer to localities) or a component action (in which case the global identifiers have to refer to instances of a component type which exposes the action.

The function passes the index of the global identifier in the given list of identifiers as the last argument to the action.

[Note] Note

The type of the initial value must be convertible to the result type returned from the invoked action.



[in] Any number of arbitrary arguments (passed by value, by const reference or by rvalue reference) which will be forwarded to the action invocation.


[in] A binary function expecting two results as returned from the action invocations. The function (or function object) is expected to return the result of the folding operation performed on its arguments.


[in] A list of global identifiers identifying the target objects for which the given action will be invoked.


[in] The initial value to be used for the folding operation


This function returns a future representing the result of the overall folding operation.