filter_view
template<
typename Sequence
, typename Pred
>
struct filter_view
{
};
filter_view is a sequence wrapper that allows one to operate on the filtered sequence without actually creating one.
#include "boost/mpl/filter_view.hpp"
| Parameter | Requirement | Description |
|---|---|---|
Sequence | A model of Sequence | A sequence to wrap. |
Pred | A model of unary Predicate [Lambda Expression] | A filtering predicate. |
| Expression | Expression type | Precondition | Semantics | Postcondition |
|---|---|---|---|---|
typedef filter_view<Sequence,Pred> s; | A model of Sequence | s prodives iterators to all the elements in the range [begin<Sequence>::type,end<Sequence>::type) that satisfy the predicate Pred. | size<s>::type::value == count_if< Sequence,Pred >::type::value. |
Amortized constant time.
Finds the largest floating type in a sequence.
typedef list<int,float,long,float,char[50],long double,char> types;
typedef max_element<
transform_view< filter_view< types,boost::is_float<_> >, size_of<_> >
>::type iter;
BOOST_STATIC_ASSERT((is_same<iter::base::type,long double>::value));
Sequences, transform_view, list, max_element