Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of boost. Click here for the latest Boost documentation.



      typename Sequence
    , typename Pred
struct remove_if
    typedef unspecified type;


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.


#include "boost/mpl/remove_if.hpp"


 Parameter  Requirement  Description  
SequenceA model of Extensible SequenceThe original sequence.
PredAn 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


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


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 Contents
Last edited July 17, 2002 8:43 am