.. Algorithms/Transformation Algorithms//remove_if |70 remove_if ========= Synopsis -------- .. parsed-literal:: template< typename Sequence , typename Pred , typename In = |unspecified| > struct remove_if { typedef |unspecified| type; }; Description ----------- Returns a new sequence that contains all the elements from |begin/end| range except those that satisfy the predicate ``Pred``. .. Returns a copy of the original sequence with all elements satisfying the predicate ``Pred`` removed. |transformation algorithm disclaimer| Header ------ .. parsed-literal:: #include Model of -------- |Reversible Algorithm| Parameters ---------- +---------------+-----------------------------------+-------------------------------+ | Parameter | Requirement | Description | +===============+===================================+===============================+ | ``Sequence`` | |Forward Sequence| | An original sequence. | +---------------+-----------------------------------+-------------------------------+ | ``Pred`` | Unary |Lambda Expression| | A removal condition. | +---------------+-----------------------------------+-------------------------------+ | ``In`` | |Inserter| | An inserter. | +---------------+-----------------------------------+-------------------------------+ Expression semantics -------------------- |Semantics disclaimer...| |Reversible Algorithm|. For any |Forward Sequence| ``s``, and an |Inserter| ``in``, and an unary |Lambda Expression| ``pred``: .. parsed-literal:: typedef remove_if::type r; :Return type: A type. :Semantics: Equivalent to .. parsed-literal:: typedef lambda::type p; typedef lambda::type op; typedef fold< s , in::state , eval_if< apply_wrap\ ``1``\ , identity<_1> , apply_wrap\ ``2``\ > >::type r; Complexity ---------- Linear. Performs exactly ``size::value`` applications of ``pred``, and at most ``size::value`` insertions. Example ------- .. parsed-literal:: typedef vector_c::type numbers; typedef remove_if< numbers, greater<_,int_<4> > >::type result; BOOST_MPL_ASSERT(( equal< result,vector_c,equal_to<_,_> > )); See also -------- |Transformation Algorithms|, |Reversible Algorithm|, |reverse_remove_if|, |remove|, |copy_if|, |replace_if|