あなたが話しているライブラリはわかりませんが、これはイテレータを使用しているようです。
Concurrency::parallel_for_each(start_iterator, end_iterator, function_object);
そして、おそらくこれと同じ効果があります(必ずしも同じ順序である必要はありませんが):
for(sometype i = start_iterator; i != end_iterator; ++i) {
function_object(*i);
}
例えば:
void do_stuff(int x) { /* ... */ }
vector<int> things;
// presumably calls do_stuff() for each thing in things
Concurrency::parallel_for_each(things.begin(), things.end(), do_stuff);
もう1つは値を取るため、これと同様の効果がある可能性があります(ただし、順序は保証されていません)。
for(sometype i = start_value; i != end_value; ++i) {
function_object(i);
}
これを実行してみてください:
void print_value(int value) {
cout << value << endl;
}
int main() {
// My guess is that this will print 0 ... 9 (not necessarily in order)
Concurrency::parallel_for(0, 10, print_value);
return 0;
}
編集:これらの動作の確認は、並列アルゴリズムのリファレンスにあります。