• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1.. Algorithms/Transformation Algorithms//reverse_remove_if |170
2
3reverse_remove_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 reverse_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
26in reverse order except those that satisfy the predicate ``Pred``.
27
28|transformation algorithm disclaimer|
29
30Header
31------
32
33.. parsed-literal::
34
35    #include <boost/mpl/remove_if.hpp>
36
37
38Model of
39--------
40
41|Reversible Algorithm|
42
43
44Parameters
45----------
46
47+---------------+-----------------------------------+-------------------------------+
48| Parameter     | Requirement                       | Description                   |
49+===============+===================================+===============================+
50| ``Sequence``  | |Forward Sequence|                | An original sequence.         |
51+---------------+-----------------------------------+-------------------------------+
52| ``Pred``      | Unary |Lambda Expression|         | A removal condition.          |
53+---------------+-----------------------------------+-------------------------------+
54| ``In``        | |Inserter|                        | An inserter.                  |
55+---------------+-----------------------------------+-------------------------------+
56
57
58Expression semantics
59--------------------
60
61|Semantics disclaimer...| |Reversible Algorithm|.
62
63For any |Forward Sequence| ``s``, and an |Inserter| ``in``, and an unary
64|Lambda Expression| ``pred``:
65
66
67.. parsed-literal::
68
69    typedef reverse_remove_if<s,pred,in>::type r;
70
71:Return type:
72    A type.
73
74:Semantics:
75    Equivalent to
76
77    .. parsed-literal::
78
79        typedef lambda<pred>::type p;
80        typedef lambda<in::operation>::type op;
81
82        typedef reverse_fold<
83              s
84            , in::state
85            , eval_if<
86                  apply_wrap\ ``1``\<p,_2>
87                , identity<_1>
88                , apply_wrap\ ``2``\<op,_1,_2>
89                >
90            >::type r;
91
92
93Complexity
94----------
95
96Linear. Performs exactly ``size<s>::value`` applications of ``pred``, and at
97most ``size<s>::value`` insertions.
98
99
100Example
101-------
102
103.. parsed-literal::
104
105    typedef vector_c<int,1,4,5,2,7,5,3,5>::type numbers;
106    typedef reverse_remove_if< numbers, greater<_,int_<4> > >::type result;
107
108    BOOST_MPL_ASSERT(( equal< result,vector_c<int,3,2,4,1>,equal_to<_,_> > ));
109
110
111See also
112--------
113
114|Transformation Algorithms|, |Reversible Algorithm|, |remove_if|, |reverse_remove|,
115|reverse_copy_if|, |replace_if|
116
117
118.. copyright:: Copyright �  2001-2009 Aleksey Gurtovoy and David Abrahams
119   Distributed under the Boost Software License, Version 1.0. (See accompanying
120   file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
121