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