hpx::experimental::for_each_index

hpx::experimental::for_each_index#

Defined in header hpx/algorithm.hpp.

See Public API for a list of names and headers that are part of the public HPX API.

template<typename Mapping, typename Fun>
constexpr void hpx::experimental::for_each_index(Mapping const &mapping, Fun fun)#

Calls fun with every multidimensional index in the domain of mapping (i.e., its extents), in sequential order.

If fun returns a result, the result is ignored.

The layout mapping is a hint; implementations are encouraged to choose an iteration order that performs well for the given mapping.

Note

Complexity: Applies fun exactly the product of all extents of mapping times.

Template Parameters:
  • Mapping – A type meeting the layout mapping requirements. Must expose index_type, extents_type, static rank(), and extents().

  • Fun – The type of the function/function object to use (deduced). Fun must meet CopyConstructible and be invocable with exactly Mapping::rank() arguments of type Mapping::index_type.

Parameters:
  • mapping – The layout mapping whose extents define the iteration domain.

  • fun – Callable invoked as fun(i0, i1, ...) for every multidimensional index in the domain.

template<typename ExPolicy, typename Mapping, typename Fun>
hpx::parallel::util::detail::algorithm_result_t<ExPolicy> hpx::experimental::for_each_index(ExPolicy &&policy, Mapping const &mapping, Fun fun)#

Calls fun with every multidimensional index in the domain of mapping (i.e., its extents), executed according to policy.

If fun returns a result, the result is ignored.

Note

Complexity: Applies fun exactly the product of all extents of mapping times.

Template Parameters:
  • ExPolicy – The type of the execution policy to use (deduced).

  • Mapping – A type meeting the layout mapping requirements. Must meet CopyConstructible.

  • Fun – The type of the function/function object to use (deduced). Must meet CopyConstructible.

Parameters:
  • policy – The execution policy to use for scheduling.

  • mapping – The layout mapping whose extents define the iteration domain.

  • fun – Callable invoked as fun(i0, i1, ...) for every multidimensional index in the domain.

Returns:

hpx::future<void> if the execution policy is sequenced_task_policy or parallel_task_policy, void otherwise.