Boost C++ Libraries

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

Click here to view the latest version of this page.
PrevUpHomeNext
remove_if
Description

Returns a new sequence, containing all the elements of the original except those where a given unary function object evaluates to true.

Synopsis
template<
    typename Pred,
    typename Sequence
    >
typename result_of::remove_if<Sequence const, Pred>::type remove_if(Sequence const& seq);

Table1.60.Parameters

Parameter

Requirement

Description

seq

A model of Forward Sequence

Operation's argument

Pred

A model of unary MPL Lambda Expression

Removal predicate


Expression Semantics
remove_if<Pred>(seq);

Return type: A model of Forward Sequence.

Semantics: Returns a new sequence, containing all the elements of seq, in their original order, except those elements with types for which Pred evaluates to boost::mpl::true_. Equivalent to filter<boost::mpl::not_<Pred> >(seq).

Complexity

Constant. Returns a view which is lazily evaluated.

Header
#include <boost/fusion/algorithm/transformation/remove_if.hpp>
#include <boost/fusion/include/remove_if.hpp>
Example
const vector<int,double> vec(1,2.0);
assert(remove_if<is_floating_point<mpl::_> >(vec) == make_vector(1));

PrevUpHomeNext