1.. Algorithms/Transformation Algorithms//remove_if |70 2 3remove_if 4========= 5 6Synopsis 7-------- 8 9.. parsed-literal:: 10 11 template< 12 typename Sequence 13 , typename Pred 14 , typename In = |unspecified| 15 > 16 struct remove_if 17 { 18 typedef |unspecified| type; 19 }; 20 21 22Description 23----------- 24 25Returns a new sequence that contains all the elements from |begin/end<Sequence>| range 26except those that satisfy the predicate ``Pred``. 27 28.. Returns a copy of the original sequence with all elements satisfying the predicate 29 ``Pred`` removed. 30 31|transformation algorithm disclaimer| 32 33Header 34------ 35 36.. parsed-literal:: 37 38 #include <boost/mpl/remove_if.hpp> 39 40 41Model of 42-------- 43 44|Reversible Algorithm| 45 46 47Parameters 48---------- 49 50+---------------+-----------------------------------+-------------------------------+ 51| Parameter | Requirement | Description | 52+===============+===================================+===============================+ 53| ``Sequence`` | |Forward Sequence| | An original sequence. | 54+---------------+-----------------------------------+-------------------------------+ 55| ``Pred`` | Unary |Lambda Expression| | A removal condition. | 56+---------------+-----------------------------------+-------------------------------+ 57| ``In`` | |Inserter| | An inserter. | 58+---------------+-----------------------------------+-------------------------------+ 59 60 61Expression semantics 62-------------------- 63 64|Semantics disclaimer...| |Reversible Algorithm|. 65 66For any |Forward Sequence| ``s``, and an |Inserter| ``in``, and an unary 67|Lambda Expression| ``pred``: 68 69 70.. parsed-literal:: 71 72 typedef remove_if<s,pred,in>::type r; 73 74:Return type: 75 A type. 76 77:Semantics: 78 Equivalent to 79 80 .. parsed-literal:: 81 82 typedef lambda<pred>::type p; 83 typedef lambda<in::operation>::type op; 84 85 typedef fold< 86 s 87 , in::state 88 , eval_if< 89 apply_wrap\ ``1``\<p,_2> 90 , identity<_1> 91 , apply_wrap\ ``2``\<op,_1,_2> 92 > 93 >::type r; 94 95 96Complexity 97---------- 98 99Linear. Performs exactly ``size<s>::value`` applications of ``pred``, and at 100most ``size<s>::value`` insertions. 101 102 103Example 104------- 105 106.. parsed-literal:: 107 108 typedef vector_c<int,1,4,5,2,7,5,3,5>::type numbers; 109 typedef remove_if< numbers, greater<_,int_<4> > >::type result; 110 111 BOOST_MPL_ASSERT(( equal< result,vector_c<int,1,4,2,3>,equal_to<_,_> > )); 112 113 114See also 115-------- 116 117|Transformation Algorithms|, |Reversible Algorithm|, |reverse_remove_if|, |remove|, |copy_if|, |replace_if| 118 119 120.. copyright:: Copyright � 2001-2009 Aleksey Gurtovoy and David Abrahams 121 Distributed under the Boost Software License, Version 1.0. (See accompanying 122 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 123