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

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

[Home]remove

Synopsis

template<
      typename Sequence
    , typename T
    >
struct remove
{
    typedef unspecified type;
};

Description

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

Definition

#include "boost/mpl/remove.hpp"

Parameters

 Parameter  Requirement  Description  
SequenceA model of Extensible SequenceThe original sequence.
TA typeA type to be removed.

Expression semantics

 Expression  Expression type  Precondition  Semantics  Postcondition 
typedef remove<Sequence,T>::type s;A model of Extensible SequenceEquivalent to typedef remove_if< Sequence,is_same<_,T> >::type t;.

Complexity

Linear. Performs exactly size<Sequence>::type::value comparisons for equality.

Example

typedef list<int,float,char,float,float,double>::type types;
typedef remove< types,float >::type result;
typedef list<int,char,double>::type answer;
BOOST_STATIC_ASSERT((equal< result,answer >::type::value));

See also

Algorithms, remove_if, replace, replace_if, transform


Table of Contents
Last edited July 17, 2002 8:43 am