]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | .. Algorithms/Transformation Algorithms//reverse_remove |160 |
2 | ||
3 | reverse_remove | |
4 | ============== | |
5 | ||
6 | Synopsis | |
7 | -------- | |
8 | ||
9 | .. parsed-literal:: | |
10 | ||
11 | template< | |
12 | typename Sequence | |
13 | , typename T | |
14 | , typename In = |unspecified| | |
15 | > | |
16 | struct reverse_remove | |
17 | { | |
18 | typedef |unspecified| type; | |
19 | }; | |
20 | ||
21 | ||
22 | ||
23 | Description | |
24 | ----------- | |
25 | ||
26 | Returns a new sequence that contains all elements from |begin/end<Sequence>| | |
27 | range in reverse order except those that are identical to ``T``. | |
28 | ||
29 | |transformation algorithm disclaimer| | |
30 | ||
31 | ||
32 | Header | |
33 | ------ | |
34 | ||
35 | .. parsed-literal:: | |
36 | ||
37 | #include <boost/mpl/remove.hpp> | |
38 | ||
39 | ||
40 | Model of | |
41 | -------- | |
42 | ||
43 | |Reversible Algorithm| | |
44 | ||
45 | ||
46 | Parameters | |
47 | ---------- | |
48 | ||
49 | +---------------+-----------------------------------+-------------------------------+ | |
50 | | Parameter | Requirement | Description | | |
51 | +===============+===================================+===============================+ | |
52 | | ``Sequence`` | |Forward Sequence| | An original sequence. | | |
53 | +---------------+-----------------------------------+-------------------------------+ | |
54 | | ``T`` | Any type | A type to be removed. | | |
55 | +---------------+-----------------------------------+-------------------------------+ | |
56 | | ``In`` | |Inserter| | An inserter. | | |
57 | +---------------+-----------------------------------+-------------------------------+ | |
58 | ||
59 | ||
60 | Expression semantics | |
61 | -------------------- | |
62 | ||
63 | |Semantics disclaimer...| |Reversible Algorithm|. | |
64 | ||
65 | For any |Forward Sequence| ``s``, an |Inserter| ``in``, and arbitrary type ``x``: | |
66 | ||
67 | ||
68 | .. parsed-literal:: | |
69 | ||
70 | typedef reverse_remove<s,x,in>::type r; | |
71 | ||
72 | :Return type: | |
73 | A type. | |
74 | ||
75 | :Semantics: | |
76 | Equivalent to | |
77 | ||
78 | .. parsed-literal:: | |
79 | ||
80 | typedef reverse_remove_if< s,is_same<_,x>,in >::type r; | |
81 | ||
82 | ||
83 | Complexity | |
84 | ---------- | |
85 | ||
86 | Linear. Performs exactly ``size<s>::value`` comparisons for equality, and at | |
87 | most ``size<s>::value`` insertions. | |
88 | ||
89 | ||
90 | Example | |
91 | ------- | |
92 | ||
93 | .. parsed-literal:: | |
94 | ||
95 | typedef vector<int,float,char,float,float,double>::type types; | |
96 | typedef reverse_remove< types,float >::type result; | |
97 | ||
98 | BOOST_MPL_ASSERT(( equal< result, vector<double,char,int> > )); | |
99 | ||
100 | ||
101 | See also | |
102 | -------- | |
103 | ||
104 | |Transformation Algorithms|, |Reversible Algorithm|, |remove|, |reverse_remove_if|, | |
105 | |reverse_copy|, |transform|, |replace| | |
106 | ||
107 | ||
108 |