GrPPI  0.2
Generic and Reusable Parallel Pattern Interface
stream_filter.h
Go to the documentation of this file.
1 
21 #ifndef GRPPI_STREAM_FILTER_H
22 #define GRPPI_STREAM_FILTER_H
23 
24 #include "seq/stream_filter.h"
25 #include "native/stream_filter.h"
26 #include "omp/stream_filter.h"
27 #include "tbb/stream_filter.h"
28 #include "poly/stream_filter.h"
29 
30 #include "common/patterns.h"
31 
32 namespace grppi {
33 
52 template <typename Execution, typename Predicate>
53 auto keep(Execution & ex, Predicate && predicate_op)
54 {
56  std::forward<Predicate>(predicate_op)};
57 }
58 
69 template <typename Execution, typename Predicate>
70 auto discard(Execution & ex, Predicate && predicate_op)
71 {
72  return keep(ex, [&](auto val) { return !predicate_op(val); });
73 }
74 
80 }
81 
82 #endif
Definition: callable_traits.h:24
Definition: patterns.h:61
void discard(parallel_execution_native &ex, Generator generate_op, Predicate predicate_op, Consumer consume_op)
Invoke Filter pattern on a data sequence with sequential execution policy. This function discards fro...
Definition: native/stream_filter.h:177
void keep(parallel_execution_native &ex, Generator generate_op, Predicate predicate_op, Consumer consume_op)
Invoke Filter pattern pattern on a data sequence with sequential execution policy. This function keeps in the stream only those items that satisfy the predicate.
Definition: native/stream_filter.h:50