私はあなたが何を言ってるのかライブラリわからないが、この1つはイテレータ取るように見える:
Concurrency::parallel_for_each(start_iterator, end_iterator, function_object);
、おそらくこれと同じ効果があります(必須ではないが、同じ順序で) :
は
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);
他方はそうほとんどの場合、それは同様のを持って、値をとります。たとえば
for(sometype i = start_iterator; i != end_iterator; ++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;
}
EDIT:あなたはParallel Algorithm referencesにこれらの行動の確認を見つけることができます
for(sometype i = start_value; i != end_value; ++i) {
function_object(i);
}
はこれを実行してみてください。
'parallel_for(i、j、f)'は 'parallel_for_each(boost :: make_counting_iterator(i)、boost :: make_counting_iterator(j)、f)'と同等であると考えることができます。 – GManNickG
MSVCの同時実行ランタイム(http://msdn.microsoft.com/en-us/library/dd504870.aspx)に言及しています。 – GManNickG
申し訳ありませんが、「ブースト」とはどういう意味ですか?それは何らかの図書館ですか? –