GrPPI  0.2
Generic and Reusable Parallel Pattern Interface
seq/map.h
Go to the documentation of this file.
1 
21 #ifndef GRPPI_SEQ_MAP_H
22 #define GRPPI_SEQ_MAP_H
23 
24 #include "sequential_execution.h"
25 
26 #include "../common/iterator.h"
27 
28 namespace grppi {
29 
50 template <typename InputIt, typename OutputIt, typename Transformer>
52  InputIt first, InputIt last, OutputIt first_out,
53  Transformer && transf_op)
54 {
55  while(first != last) {
56  *first_out = transf_op(*first);
57  first++;
58  first_out++;
59  }
60 }
61 
76 template <typename InputIt, typename OutputIt, typename Transformer,
77  typename ... OtherInputIts>
79  InputIt first, InputIt last, OutputIt first_out,
80  Transformer && transf_op,
81  OtherInputIts ... other_firsts)
82 {
83  while( first != last ) {
84  *first_out = transf_op(*first, *other_firsts...);
85  advance_iterators(other_firsts...);
86  first++;
87  first_out++;
88  }
89 }
90 
95 }
96 #endif
Definition: callable_traits.h:24
void advance_iterators(size_t delta, InputIt &...in)
Definition: iterator.h:29
Sequential execution policy.
Definition: sequential_execution.h:31
void map(parallel_execution_native &ex, InputIt first, InputIt last, OutputIt first_out, Transformer &&transf_op)
Invoke Map pattern on a data sequence with native paralell execution.
Definition: native/map.h:50