次の方法で共有


parallel_for 関数

parallel_for は、一定の範囲のインデックスを反復処理し、各反復処理で、ユーザーが指定した関数を並列で実行します。

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

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,
   const auto_partitioner& _Part = auto_partitioner()
);

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

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

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

パラメーター

  • _Index_type
    イテレーションに使用されているインデックスの型。

  • _Function
    各イテレーションで実行される関数の型。

  • _Partitioner
    指定された範囲のパーティションに分割するために使用されるパーティショナーの種類。

  • _First
    イテレーションに含まれる最初のインデックス。

  • _Last
    イテレーションに含まれる最後のインデックスより 1 つ先のインデックス。

  • _Step
    _First から _Last を繰り返すときのステップ値。 ステップは正の数である必要があります。 ステップが 1 未満の場合は、invalid_argument がスローされます。

  • _Func
    各イテレーションで実行される関数。 この関数は、ラムダ式、関数ポインター、またはシグネチャ void operator()(_Index_type**)** を持つ関数呼び出し演算子のバージョンをサポートするオブジェクトになります。

  • _Part
    パーティショナー オブジェクトへの参照。 引数は、アルゴリズムを再利用するには、その後のループの状態を保存できるように affinity_partitioner オブジェクトを使用すると、非 const 参照、lvalue 参照である必要 constauto_partitioner&conststatic_partitioner&constsimple_partitioner& または affinity_partitioner& の 1 種類があります。

解説

詳細については、「並列アルゴリズム」を参照してください。

必要条件

ヘッダー: ppl.h

名前空間: concurrency

参照

関連項目

concurrency 名前空間