11#ifndef ROOT_TSequentialExecutor
12#define ROOT_TSequentialExecutor
18#include <initializer_list>
38 template<
class F,
class INTEGER>
40 template<
class F,
class T>
41 void Foreach(F func, std::initializer_list<T> args);
42 template<
class F,
class T>
43 void Foreach(F func, std::vector<T> &args);
44 template<
class F,
class T>
45 void Foreach(F func,
const std::vector<T> &args);
70 template<
class F,
class Cond = val
idMapReturnCond<F>>
71 auto MapImpl(F func,
unsigned nTimes) -> std::vector<InvokeResult_t<F>>;
72 template<
class F,
class INTEGER,
class Cond = val
idMapReturnCond<F, INTEGER>>
74 template<
class F,
class T,
class Cond = val
idMapReturnCond<F, T>>
75 auto MapImpl(F func, std::vector<T> &args) -> std::vector<InvokeResult_t<F, T>>;
76 template<
class F,
class T,
class Cond = val
idMapReturnCond<F, T>>
77 auto MapImpl(F func,
const std::vector<T> &args) -> std::vector<InvokeResult_t<F, T>>;
89 for (
auto i = 0U; i <
nTimes; ++i) func();
97 template<
class F,
class INTEGER>
99 for(
auto i : args) func(i);
107 template<
class F,
class T>
109 std::vector<T>
vargs(std::move(args));
118 template<
class F,
class T>
120 for(
auto &&arg: args) {
130 template<
class F,
class T>
132 for(
auto &&arg: args) {
142 template<
class F,
class Cond>
144 using retType =
decltype(func());
158 template<
class F,
class INTEGER,
class Cond>
160 using retType =
decltype(func(*args.begin()));
173 template<
class F,
class T,
class Cond>
176 using retType =
decltype(func(args.front()));
179 for(
auto &&arg: args) {
180 reslist.emplace_back(func(arg));
190 template<
class F,
class T,
class Cond>
193 using retType =
decltype(func(args.front()));
196 for(
auto &&arg: args) {
197 reslist.emplace_back(func(arg));
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
This class defines an interface to execute the same task multiple times, possibly in parallel and wit...
auto MapReduce(F func, unsigned nTimes, R redfunc) -> InvokeResult_t< F >
Execute a function without arguments several times (Map) and accumulate the results into a single val...
auto Map(F func, unsigned nTimes) -> std::vector< InvokeResult_t< F > >
Execute a function without arguments several times.
T * Reduce(const std::vector< T * > &mergeObjs)
"Reduce" an std::vector into a single object by using the object's Merge method.
A pseudo container class which is a generator of indices.
void Foreach(F func, unsigned nTimes)
Execute a function without arguments several times, dividing the execution in nChunks.
unsigned GetPoolSize() const
Return the number of workers in the sequential executor: a single one.
TSequentialExecutor()=default
auto MapImpl(F func, unsigned nTimes) -> std::vector< InvokeResult_t< F > >
Execute a function without arguments several times.
TSequentialExecutor(const TSequentialExecutor &)=delete
TSequentialExecutor & operator=(const TSequentialExecutor &)=delete
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...