...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
template< 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 |
---|---|---|
Sequence | A model of Extensible Sequence | The original sequence. |
Pred | An unary Predicate [Lambda Expression] | A removal condition. |
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));
Algorithms, remove
, replace
, transform