...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
For a given sequence, filter returns a new sequences containing only the elements of a specified type.
template<
typename T,
typename Sequence
>
typename result_of::filter
<Sequence const, T>::type filter(Sequence const& seq);
Table 1.64. Parameters
Parameter |
Requirement |
Description |
---|---|---|
|
A model of Forward Sequence |
Operation's argument |
|
Any type |
The type to retain |
filter
<T>(seq);
Return type:
seq
implements the Associative
Sequence model.
Semantics: Returns a sequence containing
all the elements of seq
of type T
. Equivalent
to
.
filter_if
<boost::same_type<_, T> >(seq)
Constant. Returns a view which is lazily evaluated.
#include <boost/fusion/algorithm/transformation/filter.hpp> #include <boost/fusion/include/filter.hpp>
constvector
<int,int,long,long> vec(1,2,3,4); assert(filter
<int>(vec) ==make_vector
(1,2));