• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1.. Algorithms/Transformation Algorithms//remove |60
2
3remove
4======
5
6Synopsis
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
22Description
23-----------
24
25Returns a new sequence that contains all elements from |begin/end<Sequence>|
26range 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
34Header
35------
36
37.. parsed-literal::
38
39    #include <boost/mpl/remove.hpp>
40
41
42Model of
43--------
44
45|Reversible Algorithm|
46
47
48Parameters
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
62Expression semantics
63--------------------
64
65|Semantics disclaimer...| |Reversible Algorithm|.
66
67For 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
85Complexity
86----------
87
88Linear. Performs exactly ``size<s>::value`` comparisons for equality, and at
89most ``size<s>::value`` insertions.
90
91
92Example
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
103See also
104--------
105
106|Transformation Algorithms|, |Reversible Algorithm|, |reverse_remove|, |remove_if|, |copy|, |replace|
107
108
109.. copyright:: Copyright �  2001-2009 Aleksey Gurtovoy and David Abrahams
110   Distributed under the Boost Software License, Version 1.0. (See accompanying
111   file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
112