...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
template<
typename Sequence
, typename Pred
>
struct filter_view
{
// unspecified
};
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
, joint_view
, zip_view
, max_element