boost::mpl::filter_view

# filter_view

### Synopsis

    template<
          typename Sequence
        , typename Pred
        >
    struct filter_view
    {
        // unspecified
    };

### Description

`filter_view` is a sequence wrapper that allows one to operate on the filtered sequence without actually creating one.

### Definition

    #include "boost/mpl/filter_view.hpp"

### Parameters

Parameter | Requirement | Description
--- | --- | ---
`Sequence` | A model of Sequence | A sequence to wrap.
`Pred` | A model of unary Predicate [Lambda Expression] | A filtering predicate.

### Expression semantics

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`.

### Complexity

Amortized constant time.

### Example

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));

### See also

Sequences, `transform_view`, `joint_view`, `zip_view`, `max_element`

Table of Contents
Last edited March 10, 2003 4:42 am