• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1.. Sequences/Intrinsic Metafunctions//clear
2
3clear
4=====
5
6Synopsis
7--------
8
9.. parsed-literal::
10
11    template<
12          typename Sequence
13        >
14    struct clear
15    {
16        typedef |unspecified| type;
17    };
18
19
20
21Description
22-----------
23
24Returns an empty sequence |concept-identical| to ``Sequence``.
25
26
27Header
28------
29
30.. parsed-literal::
31
32    #include <boost/mpl/clear.hpp>
33
34
35Model of
36--------
37
38|Tag Dispatched Metafunction|
39
40
41Parameters
42----------
43
44+---------------+-----------------------------------+---------------------------------------+
45| Parameter     | Requirement                       | Description                           |
46+===============+===================================+=======================================+
47| ``Sequence``  | |Extensible Sequence| or          | A sequence to get an empty "copy" of. |
48|               | |Extensible Associative Sequence| |                                       |
49+---------------+-----------------------------------+---------------------------------------+
50
51
52Expression semantics
53--------------------
54
55For any |Extensible Sequence| or |Extensible Associative Sequence| ``s``:
56
57
58.. parsed-literal::
59
60    typedef clear<s>::type t;
61
62:Return type:
63    |Extensible Sequence| or |Extensible Associative Sequence|.
64
65:Semantics:
66    Equivalent to
67
68    .. parsed-literal::
69
70       typedef erase< s, begin<s>::type, end<s>::type >::type t;
71
72
73:Postcondition:
74    ``empty<s>::value == true``.
75
76
77Complexity
78----------
79
80Amortized constant time.
81
82
83Example
84-------
85
86.. parsed-literal::
87
88    typedef vector_c<int,1,3,5,7,9,11> odds;
89    typedef clear<odds>::type nothing;
90
91    BOOST_MPL_ASSERT(( empty<nothing> ));
92
93
94See also
95--------
96
97|Extensible Sequence|, |Extensible Associative Sequence|, |erase|, |empty|, |begin|, |end|
98
99
100.. copyright:: Copyright �  2001-2009 Aleksey Gurtovoy and David Abrahams
101   Distributed under the Boost Software License, Version 1.0. (See accompanying
102   file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
103