// print_array complie with: /EHsc
#include <ppl.h>
#include <array>
#include <algorithm>
#include <iostream>
using namespace Concurrency;
using namespace std;
using namespace std::tr1;
int main()
{
array<int, 3> a = {13, 26, 39};
cout << "Using for_each:" << endl;
for_each(a.begin(), a.end(), [&](int n){ cout << n << endl;} );
// 使用 parallel_for_each来完成同样的任务
cout << "Using parallel_for_each:" << endl;
parallel_for_each(a.begin(), a.end(), [&](int n) {cout << n << endl;} );
system("pause");
return 0;
}
parallel_for_each
最新推荐文章于 2024-08-05 14:09:42 发布