]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | .. Sequences/Intrinsic Metafunctions//clear |
2 | ||
3 | clear | |
4 | ===== | |
5 | ||
6 | Synopsis | |
7 | -------- | |
8 | ||
9 | .. parsed-literal:: | |
10 | ||
11 | template< | |
12 | typename Sequence | |
13 | > | |
14 | struct clear | |
15 | { | |
16 | typedef |unspecified| type; | |
17 | }; | |
18 | ||
19 | ||
20 | ||
21 | Description | |
22 | ----------- | |
23 | ||
24 | Returns an empty sequence |concept-identical| to ``Sequence``. | |
25 | ||
26 | ||
27 | Header | |
28 | ------ | |
29 | ||
30 | .. parsed-literal:: | |
31 | ||
32 | #include <boost/mpl/clear.hpp> | |
33 | ||
34 | ||
35 | Model of | |
36 | -------- | |
37 | ||
38 | |Tag Dispatched Metafunction| | |
39 | ||
40 | ||
41 | Parameters | |
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 | ||
52 | Expression semantics | |
53 | -------------------- | |
54 | ||
55 | For 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 | ||
77 | Complexity | |
78 | ---------- | |
79 | ||
80 | Amortized constant time. | |
81 | ||
82 | ||
83 | Example | |
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 | ||
94 | See also | |
95 | -------- | |
96 | ||
97 | |Extensible Sequence|, |Extensible Associative Sequence|, |erase|, |empty|, |begin|, |end| | |
98 | ||
99 | ||
100 |