GrPPI
0.2
Generic and Reusable Parallel Pattern Interface
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
include
seq
seq/reduce.h
Go to the documentation of this file.
1
21
#ifndef GRPPI_SEQ_REDUCE_H
22
#define GRPPI_SEQ_REDUCE_H
23
24
#include "
sequential_execution.h
"
25
26
namespace
grppi
{
27
48
template
<
typename
InputIt,
typename
Identity,
typename
Combiner>
49
auto
reduce
(
sequential_execution
& ex, InputIt first, InputIt last,
50
Identity identity,
51
Combiner && combine_op)
52
{
53
auto
result = identity;
54
while
(first != last) {
55
result = combine_op(result, *first);
56
first++;
57
}
58
return
result;
59
}
60
66
}
67
68
#endif
grppi
Definition:
callable_traits.h:24
grppi::sequential_execution
Sequential execution policy.
Definition:
sequential_execution.h:31
sequential_execution.h
grppi::reduce
auto reduce(parallel_execution_native &ex, InputIt first, InputIt last, Identity identity, Combiner &&combine_op)
Invoke Reduce pattern with identity value on a data sequence with parallel native execution...
Definition:
native/reduce.h:51
Generated by
1.8.11