]>
Commit | Line | Data |
---|---|---|
1 | .. Sequences/Intrinsic Metafunctions//end | |
2 | ||
3 | end | |
4 | === | |
5 | ||
6 | Synopsis | |
7 | -------- | |
8 | ||
9 | .. parsed-literal:: | |
10 | ||
11 | template< | |
12 | typename X | |
13 | > | |
14 | struct end | |
15 | { | |
16 | typedef |unspecified| type; | |
17 | }; | |
18 | ||
19 | ||
20 | ||
21 | Description | |
22 | ----------- | |
23 | ||
24 | Returns the sequence's past-the-end iterator. If the argument is not a | |
25 | |Forward Sequence|, returns |void_|. | |
26 | ||
27 | ||
28 | Header | |
29 | ------ | |
30 | ||
31 | .. parsed-literal:: | |
32 | ||
33 | #include <boost/mpl/begin_end.hpp> | |
34 | ||
35 | ||
36 | Model of | |
37 | -------- | |
38 | ||
39 | |Tag Dispatched Metafunction| | |
40 | ||
41 | ||
42 | Parameters | |
43 | ---------- | |
44 | ||
45 | +---------------+-------------------+-----------------------------------------------+ | |
46 | | Parameter | Requirement | Description | | |
47 | +===============+===================+===============================================+ | |
48 | | ``X`` | Any type | A type whose end iterator, if any, will be | | |
49 | | | | returned. | | |
50 | +---------------+-------------------+-----------------------------------------------+ | |
51 | ||
52 | ||
53 | Expression semantics | |
54 | -------------------- | |
55 | ||
56 | For any arbitrary type ``x``: | |
57 | ||
58 | .. parsed-literal:: | |
59 | ||
60 | typedef end<x>::type last; | |
61 | ||
62 | :Return type: | |
63 | |Forward Iterator| or |void_|. | |
64 | ||
65 | :Semantics: | |
66 | If ``x`` is |Forward Sequence|, ``last`` is an iterator pointing one past the | |
67 | last element in ``s``; otherwise ``last`` is |void_|. | |
68 | ||
69 | :Postcondition: | |
70 | If ``last`` is an iterator, it is past-the-end. | |
71 | ||
72 | ||
73 | Complexity | |
74 | ---------- | |
75 | ||
76 | Amortized constant time. | |
77 | ||
78 | ||
79 | Example | |
80 | ------- | |
81 | ||
82 | .. parsed-literal:: | |
83 | ||
84 | typedef vector<long> v; | |
85 | typedef begin<v>::type first; | |
86 | typedef end<v>::type last; | |
87 | ||
88 | BOOST_MPL_ASSERT(( is_same< next<first>::type, last > )); | |
89 | ||
90 | ||
91 | See also | |
92 | -------- | |
93 | ||
94 | |Iterators|, |Forward Sequence|, |begin|, |end|, |next| | |
95 | ||
96 | ||
97 |