parallel_for Function

parallel_for iterates over a range of indices and executes a user-supplied function at each iteration, in parallel.

template <
   typename _Index_type,
   typename _Function
>
void parallel_for(
   _Index_type_First,
   _Index_type_Last,
   _Index_type_Step,
   const _Function& _Func
);
template <
   typename _Index_type,
   typename _Function
>
void parallel_for(
   _Index_type_First,
   _Index_type_Last,
   const _Function& _Func
);

Parameters

  • _Index_type
    The type of the index being used for the iteration. _Index_type must be an integral type.

  • _Function
    The type of the function that will be executed at each iteration.

  • _First
    The first index to be included in the iteration.

  • _Last
    The index one past the last index to be included in the iteration.

  • _Step
    The value by which to step when iterating from _First to _Last. The step must be positive. invalid_argument is thrown if the step is less than 1.

  • _Func
    The function to be executed at each iteration. This may be a lambda expression, a function pointer, or any object that supports a version of the function call operator with the signature void operator()(_Index_type**)**.

Remarks

For more information, see Parallel Algorithms.

Requirements

Header: ppl.h

Namespace: Concurrency

See Also

Reference

Concurrency Namespace