66 template<
class F,
class...
T>
67 using noReferenceCond =
typename std::enable_if<
"Function can't return a reference" && !(std::is_reference<
typename std::result_of<
F(
T...)>
::type>::value)>
::type;
72 template<
class F,
class Cond = noReferenceCond<F>>
73 auto Map(
F func,
unsigned nTimes) -> std::vector<
typename std::result_of<
F()>
::type>;
74 template<
class F,
class INTEGER,
class Cond = noReferenceCond<F, INTEGER>>
77 template<
class F,
class T,
class Cond = noReferenceCond<F, T>>
78 auto Map(
F func, std::initializer_list<T> args) -> std::vector<
typename std::result_of<
F(
T)>
::type>;
80 template<
class F,
class T,
class Cond = noReferenceCond<F, T>>
81 auto Map(
F func, std::vector<T> &args) -> std::vector<
typename std::result_of<
F(
T)>
::type>;
87 template<
class F,
class INTEGER,
class R,
class Cond = noReferenceCond<F, INTEGER>>
90 template<
class F,
class T,
class R,
class Cond = noReferenceCond<F, T>>
91 auto MapReduce(
F func, std::initializer_list<T> args,
R redfunc) ->
typename std::result_of<
F(
T)>
::type;
93 template<
class F,
class T,
class Cond = noReferenceCond<F, T>>
96 template<
class T>
T*
Reduce(
const std::vector<T*> &mergeObjs);
101 return *
static_cast<subc*
>(
this);
110template<
class subc>
template<
class F,
class Cond>
113 return Derived().Map(func, nTimes);
120template<
class subc>
template<
class F,
class INTEGER,
class Cond>
123 return Derived().Map(func, args);
130template<
class subc>
template<
class F,
class T,
class Cond>
133 std::vector<T> vargs(std::move(args));
134 return Map(func, vargs);
143template<
class subc>
template<
class F,
class T,
class Cond>
146 return Derived().Map(func, args);
155template<
class subc>
template<
class F,
class INTEGER,
class R,
class Cond>
158 std::vector<INTEGER> vargs(args.size());
159 std::copy(args.begin(), args.end(), vargs.begin());
160 return Derived().MapReduce(func, vargs, redfunc);
163template<
class subc>
template<
class F,
class T,
class R,
class Cond>
166 std::vector<T> vargs(std::move(args));
167 return Derived().MapReduce(func, vargs, redfunc);
170template<
class subc>
template<
class F,
class T,
class Cond>
173 return Derived().Reduce(
Map(func, args));
179template<
class subc>
template<
class T>
183 for(
unsigned i =1; i<mergeObjs.size(); i++){
187 auto retHist =
dynamic_cast<T*
>((mergeObjs.front())->Clone());
188 if (retHist) retHist->Merge(&
l);
#define R(a, b, c, d, e, f, g, h, i)
This class defines an interface to execute the same task multiple times in parallel,...
auto Map(F func, unsigned nTimes) -> std::vector< typename std::result_of< F()>::type >
Execute func (with no arguments) nTimes in parallel.
auto Map(F func, ROOT::TSeq< INTEGER > args) -> std::vector< typename std::result_of< F(INTEGER)>::type >
Execute func in parallel, taking an element of a sequence as argument.
auto Map(F func, std::vector< T > &args) -> std::vector< typename std::result_of< F(T)>::type >
Execute func in parallel, taking an element of an std::vector as argument.
T * MapReduce(F func, std::vector< T * > &args)
typename std::enable_if<"Function can't return a reference" &&!(std::is_reference< typename std::result_of< F(T...)>::type >::value)>::type noReferenceCond
auto MapReduce(F func, ROOT::TSeq< INTEGER > args, R redfunc) -> typename std::result_of< F(INTEGER)>::type
This method behaves just like Map, but an additional redfunc function must be provided.
T * Reduce(const std::vector< T * > &mergeObjs)
"Reduce" an std::vector into a single object by using the object's Merge
A pseudo container class which is a generator of indices.
auto Map(Args &&... args) -> decltype(ROOT::Detail::VecOps::MapFromTuple(std::forward_as_tuple(args...), std::make_index_sequence< sizeof...(args) - 1 >()))
Create new collection applying a callable to the elements of the input collection.
Namespace for new ROOT classes and functions.