Home | Libraries | People | FAQ | More |
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.53. Parameters
Parameter |
Requirement |
Description |
---|---|---|
seq |
A model of Forward Sequence |
Operation's argument |
T |
Any type |
The type to retain |
filter<T>(seq);
Return type: A model of Forward Sequence.
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>
const vector<int,int,long,long> vec(1,2,3,4); assert(filter<int>(vec) == make_vector(1,2));