GrPPI  0.2
Generic and Reusable Parallel Pattern Interface
seq/mapreduce.h
Go to the documentation of this file.
1 
21 #ifndef GRPPI_SEQ_MAPREDUCE_H
22 #define GRPPI_SEQ_MAPREDUCE_H
23 
24 #include "sequential_execution.h"
25 
26 namespace grppi {
27 
51 template <typename InputIt, typename Result, typename Transformer,
52  typename Combiner>
54  InputIt first, InputIt last,
55  Result identity,
56  Transformer && transform_op, Combiner && combine_op)
57 {
58  Result out = identity;
59 
60  using namespace std;
61 
62  while (first!=last) {
63  auto x = transform_op(*first);
64  out = combine_op(out,x);
65  first++;
66  }
67 
68  return out;
69 }
70 
71 }
72 
73 #endif
Definition: callable_traits.h:24
STL namespace.
Result map_reduce(parallel_execution_native &ex, InputIt first, InputIt last, Result identity, Transformer &&transform_op, Combiner &&combine_op)
Invoke Map/reduce pattern on a data sequence with native parallel execution.
Definition: native/mapreduce.h:53
Sequential execution policy.
Definition: sequential_execution.h:31