]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | .. Iterators/Iterator Metafunctions//next |30 |
2 | ||
3 | next | |
4 | ==== | |
5 | ||
6 | Synopsis | |
7 | -------- | |
8 | ||
9 | .. parsed-literal:: | |
10 | ||
11 | template< | |
12 | typename Iterator | |
13 | > | |
14 | struct next | |
15 | { | |
16 | typedef |unspecified| type; | |
17 | }; | |
18 | ||
19 | ||
20 | ||
21 | Description | |
22 | ----------- | |
23 | ||
24 | Returns the next iterator in the sequence. |Note:| ``next`` has a number of | |
25 | overloaded meanings, depending on the type of its argument. For instance, | |
26 | if ``X`` is an |Integral Constant|, ``next<X>`` returns an incremented | |
27 | |Integral Constant| of the same type. The following specification is | |
28 | iterator-specific. Please refer to the corresponding concept's | |
29 | documentation for the details of the alternative semantics |-- end note|. | |
30 | ||
31 | ||
32 | Header | |
33 | ------ | |
34 | ||
35 | .. parsed-literal:: | |
36 | ||
37 | #include <boost/mpl/next_prior.hpp> | |
38 | ||
39 | ||
40 | Parameters | |
41 | ---------- | |
42 | ||
43 | +---------------+---------------------------+-----------------------------------+ | |
44 | | Parameter | Requirement | Description | | |
45 | +===============+===========================+===================================+ | |
46 | | ``Iterator`` | |Forward Iterator|. | An iterator to increment. | | |
47 | +---------------+---------------------------+-----------------------------------+ | |
48 | ||
49 | ||
50 | Expression semantics | |
51 | -------------------- | |
52 | ||
53 | For any |Forward Iterator|\ s ``iter``: | |
54 | ||
55 | ||
56 | .. parsed-literal:: | |
57 | ||
58 | typedef next<iter>::type j; | |
59 | ||
60 | :Return type: | |
61 | |Forward Iterator|. | |
62 | ||
63 | :Precondition: | |
64 | ``iter`` is incrementable. | |
65 | ||
66 | :Semantics: | |
67 | ``j`` is an iterator pointing to the next element in the sequence, or | |
68 | is past-the-end. If ``iter`` is a user-defined iterator, the | |
69 | library-provided default implementation is equivalent to | |
70 | ||
71 | .. parsed-literal:: | |
72 | ||
73 | typedef iter::next j; | |
74 | ||
75 | ||
76 | Complexity | |
77 | ---------- | |
78 | ||
79 | Amortized constant time. | |
80 | ||
81 | ||
82 | Example | |
83 | ------- | |
84 | ||
85 | .. parsed-literal:: | |
86 | ||
87 | typedef vector_c<int,1> v; | |
88 | typedef begin<v>::type first; | |
89 | typedef end<v>::type last; | |
90 | ||
91 | BOOST_MPL_ASSERT(( is_same< next<first>::type, last > )); | |
92 | ||
93 | ||
94 | See also | |
95 | -------- | |
96 | ||
97 | |Iterators|, |begin| / |end|, |prior|, |deref| | |
98 | ||
99 | ||
100 |