#ifdef USE_TBB
#include <tbb/parallel_for.h>
#include <tbb/blocked_range.h>
#endif //USE_TBB
#include <iostream>
#include <vector>
int main() {
std::vector<int> data(100);
#ifdef USE_TBB
tbb::parallel_for(tbb::blocked_range<int>(0, data.size()), [&](const tbb::blocked_range<int>& r) {
for (int i = r.begin(); i != r.end(); ++i) {
std::cout << "i = " << i << std::endl;
data[i] = i * 2; // Example operation
}
});
#endif
for (int val : data) {
std::cout << val << " ";
}
std::cout << std::endl;
return 0;
}
I2lmZGVmIFVTRV9UQkIKICAgICNpbmNsdWRlIDx0YmIvcGFyYWxsZWxfZm9yLmg+CiAgICNpbmNsdWRlIDx0YmIvYmxvY2tlZF9yYW5nZS5oPgojZW5kaWYgLy9VU0VfVEJCCgojaW5jbHVkZSA8aW9zdHJlYW0+CiAgICAjaW5jbHVkZSA8dmVjdG9yPgoKICAgIGludCBtYWluKCkgewogICAgICAgIHN0ZDo6dmVjdG9yPGludD4gZGF0YSgxMDApOwogICAgICAgICNpZmRlZiBVU0VfVEJCCiAgICAgICAgdGJiOjpwYXJhbGxlbF9mb3IodGJiOjpibG9ja2VkX3JhbmdlPGludD4oMCwgZGF0YS5zaXplKCkpLCBbJl0oY29uc3QgdGJiOjpibG9ja2VkX3JhbmdlPGludD4mIHIpIHsKICAgICAgICAgICAgZm9yIChpbnQgaSA9IHIuYmVnaW4oKTsgaSAhPSByLmVuZCgpOyArK2kpIHsKICAgICAgICAgICAgICAgIHN0ZDo6Y291dCA8PCAiaSA9ICIgPDwgaSA8PCBzdGQ6OmVuZGw7CiAgICAgICAgICAgICAgICBkYXRhW2ldID0gaSAqIDI7IC8vIEV4YW1wbGUgb3BlcmF0aW9uCiAgICAgICAgICAgIH0KICAgICAgICB9KTsKICAgICAgICAjZW5kaWYKCiAgICAgICAgZm9yIChpbnQgdmFsIDogZGF0YSkgewogICAgICAgICAgICBzdGQ6OmNvdXQgPDwgdmFsIDw8ICIgIjsKICAgICAgICB9CiAgICAgICAgc3RkOjpjb3V0IDw8IHN0ZDo6ZW5kbDsKCiAgICAgICAgcmV0dXJuIDA7CiAgICB9