21 #ifndef GRPPI_POLY_STREAM_FILTER_H 22 #define GRPPI_POLY_STREAM_FILTER_H 25 #include "../common/support.h" 29 template <
typename Generator,
typename Predicate,
typename Consumer>
31 Predicate predicate_op, Consumer consume_op)
35 template <
typename E,
typename ... O,
36 typename Generator,
typename Predicate,
typename Consumer,
39 Generator && generate_op,
40 Predicate && predicate_op, Consumer && consume_op)
43 std::forward<Predicate>(predicate_op), std::forward<Consumer>(consume_op));
48 template <
typename E,
typename ... O,
49 typename Generator,
typename Predicate,
typename Consumer,
52 Generator && generate_op,
53 Predicate && predicate_op,
54 Consumer && consume_op)
56 if (
typeid(E) == ex.
type()) {
58 std::forward<Generator>(generate_op), std::forward<Predicate>(predicate_op),
59 std::forward<Consumer>(consume_op));
63 std::forward<Predicate>(predicate_op), std::forward<Consumer>(consume_op));
68 template <
typename Generator,
typename Predicate,
typename Consumer>
70 Predicate predicate_op, Consumer consume_op)
74 template <
typename E,
typename ... O,
75 typename Generator,
typename Predicate,
typename Consumer,
76 internal::requires_execution_not_supported<E> = 0>
78 Generator && generate_op,
79 Predicate && predicate_op, Consumer && consume_op)
82 std::forward<Predicate>(predicate_op), std::forward<Consumer>(consume_op));
87 template <
typename E,
typename ... O,
88 typename Generator,
typename Predicate,
typename Consumer,
89 internal::requires_execution_supported<E> = 0>
91 Generator && generate_op,
92 Predicate && predicate_op,
93 Consumer && consume_op)
95 if (
typeid(E) == ex.
type()) {
97 std::forward<Generator>(generate_op), std::forward<Predicate>(predicate_op),
98 std::forward<Consumer>(consume_op));
102 std::forward<Predicate>(predicate_op), std::forward<Consumer>(consume_op));
127 template <
typename Generator,
typename Predicate,
typename Consumer>
129 Predicate && predicate_op, Consumer && consume_op)
136 >(ex, std::forward<Generator>(generate_op),
137 std::forward<Predicate>(predicate_op),
138 std::forward<Consumer>(consume_op));
154 template <
typename Generator,
typename Predicate,
typename Consumer>
156 Predicate && predicate_op, Consumer && consume_op)
163 >(ex, std::forward<Generator>(generate_op),
164 std::forward<Predicate>(predicate_op),
165 std::forward<Consumer>(consume_op));
Definition: callable_traits.h:24
void discard_multi_impl(polymorphic_execution, Generator &&generate_op, Predicate predicate_op, Consumer consume_op)
Definition: poly/stream_filter.h:69
Native parallel execution policy. This policy uses ISO C++ threads as implementation building block a...
Definition: parallel_execution_native.h:136
const std::type_info & type() const noexcept
Definition: polymorphic_execution.h:77
std::enable_if_t< is_supported< E >(), int > requires_execution_supported
Definition: support.h:32
OpenMP parallel execution policy.
Definition: parallel_execution_omp.h:40
TBB parallel execution policy.
Definition: parallel_execution_tbb.h:37
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
E * execution_ptr()
Get the execution pointer for a given type.
Definition: polymorphic_execution.h:91
Sequential execution policy.
Definition: sequential_execution.h:31
Definition: polymorphic_execution.h:63
std::enable_if_t<!is_supported< E >(), int > requires_execution_not_supported
Definition: support.h:36
void keep_multi_impl(polymorphic_execution, Generator &&generate_op, Predicate predicate_op, Consumer consume_op)
Definition: poly/stream_filter.h:30