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 to view this page for the latest version.
Front Page / Algorithms / Transformation Algorithms / reverse_remove



      typename Sequence
    , typename T
    , typename In = unspecified
struct reverse_remove
    typedef unspecified type;


Returns a new sequence that contains all elements from [begin<Sequence>::type, end<Sequence>::type) range in reverse order except those that are identical to T.

[Note: This wording applies to a no-inserter version(s) of the algorithm. See the Expression semantics subsection for a precise specification of the algorithm's details in all cases — end note]


#include <boost/mpl/remove.hpp>

Model of

Reversible Algorithm


Parameter Requirement Description
Sequence Forward Sequence An original sequence.
T Any type A type to be removed.
In Inserter An inserter.

Expression semantics

The semantics of an expression are defined only where they differ from, or are not defined in Reversible Algorithm.

For any Forward Sequence s, an Inserter in, and arbitrary type x:

typedef reverse_remove<s,x,in>::type r;
Return type:

A type.


Equivalent to

typedef reverse_remove_if< s,is_same<_,x>,in >::type r;


Linear. Performs exactly size<s>::value comparisons for equality, and at most size<s>::value insertions.


typedef vector<int,float,char,float,float,double>::type types;
typedef reverse_remove< types,float >::type result;

BOOST_MPL_ASSERT(( equal< result, vector<double,char,int> > ));

See also

Transformation Algorithms, Reversible Algorithm, remove, reverse_remove_if, reverse_copy, transform, replace