filter¶
[algorithms.parallel_pipeline.filter]
A filter class template represents a strongly-typed filter in a parallel_pipeline algorithm,
with its template parameters specifying the filter input and output types.
A filter can be constructed from a functor or by composing two filter objects with
operator&(). The same filter object can be reused in multiple & expressions.
The filter class should only be used in conjunction with parallel_pipeline functions.
// Defined in header <oneapi/tbb/parallel_pipeline.h>
namespace oneapi {
namespace tbb {
template<typename InputType, typename OutputType>
class filter {
public:
filter() = default;
filter( const filter& rhs ) = default;
filter( filter&& rhs ) = default;
void operator=(const filter& rhs) = default;
void operator=( filter&& rhs ) = default;
template<typename Body>
filter( filter_mode mode, const Body& body );
filter& operator&=( const filter<OutputType,OutputType>& right );
void clear();
}
template<typename T, typename U, typename Body>
filter<T,U> make_filter( filter::mode mode, const Body& f );
template<typename T, typename V, typename U>
filter<T,U> operator&( const filter<T,V>& left, const filter<V,U>& right );
} // namespace tbb
} // namespace oneapi
Requirements:
If InputType is
void, aBodytype must meet the StartFilterBody requirements.If OutputType is
void, aBodytype must meet the OutputFilterBody requirements.If InputType and OutputType are not
void, aBodytype must meet the MiddleFilterBody requirements.If InputType and OutputType are
void, aBodytype must meet the SingleFilterBody requirements.
filter_mode Enumeration¶
Member functions¶
-
filter()¶
Constructs an undefined filter.
Caution
The effect of using an undefined filter by
operator&()orparallel_pipelineis undefined.
-
template<typename Body>
filter(filter_mode mode, const Body &body)¶ Constructs a
filterthat uses a copy of a providedbodyto map an input value of type InputType to an output value of type OutputType, and that operates in the specifiedmode.
-
void clear()¶
Sets
*thisto an undefined filter.
Non-member functions¶
Deduction Guides¶
template<typename Body>
filter(filter_mode, Body) -> filter<filter_input<Body>, filter_output<Body>>;
Where:
filter_input<Body>is an alias to theBody::operator()input parameter type. IfBody::operator()input parameter type isflow_controlthenfilter_input<Body>isvoid.filter_output<Body>is an alias to theBody::operator()return type.