All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Functions
tbb_pfor_01_t.cc File Reference
#include "tbb/tbb.h"
#include <iostream>

Go to the source code of this file.

Functions

int main ()
 

Function Documentation

int main ( )

Definition at line 13 of file tbb_pfor_01_t.cc.

14 {
15  size_t const n = 500000;
16  std::vector<double> v(n, 27.64), vr;
17  vr.reserve(n);
19  tbb::parallel_for(br_t(v.cbegin(), v.cend()), [&vr](br_t const& r) -> void {
20  for (auto i : r) {
21  vr.emplace_back(i * 2.0);
22  }
23  });
24  std::cout << vr.back() << std::endl;
25 }
tbb::blocked_range< typename std::vector< double >::const_iterator > br_t
intermediate_table::const_iterator const_iterator