3 #define TBB_PREVIEW_TASK_GROUP_EXTENSIONS 1
4 #include <tbb/blocked_range.h>
5 #include <tbb/parallel_for.h>
6 #include <tbb/parallel_reduce.h>
7 #include <tbb/task_arena.h>
8 #include <tbb/task_group.h>
10 namespace threading_tbb {
12 using tbb::blocked_range;
13 using tbb::task_arena;
14 using tbb::task_group;
15 namespace this_task_arena {
16 using namespace tbb::this_task_arena;
20 template <
typename...
X>
27 template <
typename...
X>
30 return this_task_arena::isolate(
46 std::unique_ptr<tbb_packaged_task<T>>
task_;
61 std::unique_ptr<tbb_packaged_task<void>>
task_;
68 void get() { wait(); }
71 template <
typename Fn,
73 typename Result = std::result_of_t<Fn && (Args && ...)>>
75 auto f = std::bind(std::forward<Fn>(fn), std::forward<Args>(
args)...);
76 auto ptask = std::make_unique<tbb_packaged_task<Result>>();
77 #if TBB_INTERFACE_VERSION >= 12040
future(std::unique_ptr< tbb_packaged_task< void >> &&p)
future(std::unique_ptr< tbb_packaged_task< T >> &&p)
tbb::task_arena g_tbb_arena
auto parallel_reduce(X &&...x) -> decltype(tbb::parallel_reduce(std::forward< X >(x)...))
Value parallel_reduce(const blocked_range< Int > &range, const Value &identity, const RealBody &real_body, const Reduction &reduction, const Partitioner &p=Partitioner())
Parallel iteration with reduction.
void parallel_for(const blocked_range< Int > &range, const Body &body, const Partitioner &p=Partitioner())
std::unique_ptr< tbb_packaged_task< T > > task_
std::unique_ptr< tbb_packaged_task< void > > task_
future< Result > async(Fn &&fn, Args &&...args)
void parallel_for(X &&...x)