# remove_if

### Synopsis

    template<
          typename Sequence
        , typename Pred
        >
    struct remove_if
    {
        typedef unspecified type;
    };

### Description

Returns a new sequence which contains all the elements from `[begin<Sequence>::type, end<Sequence>::type)` range except those that satisfy the predicate `Pred`. The result sequence preserves all the functional and performance characteristics of the original `Sequence`, except its size and identity.

### Definition

    #include "boost/mpl/remove_if.hpp"

### Parameters

Parameter | Requirement | Description
--- | --- | ---
`Sequence` | A model of Extensible Sequence | The original sequence.
`Pred` | An unary Predicate [Lambda Expression] | A removal condition.

### Expression semantics

Expression | Expression type | Precondition | Semantics | Postcondition
--- | --- | --- | --- | ---
`typedef remove_if<Sequence,Pred>::type s;` | A model of Extensible Sequence |  |  |

### Complexity

Linear. Performs exactly `size<Sequence>::type::value` applications of `Pred`.

### Example

    typedef list_c<int,1,4,5,2,7,5,3,5>::type numbers;
    typedef remove_if< numbers, greater<_,4> >::type result;
    typedef list_c<int,1,4,2,3>::type answer;
    BOOST_STATIC_ASSERT((equal< answer,result,equal_to<_,_> >::type::value));

### See also

Algorithms, `remove`, `replace`, `transform`

Table of Content | Reference
Last edited July 17, 2002 8:43 am