• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1.. Iterators/Iterator Metafunctions//next |30
2
3next
4====
5
6Synopsis
7--------
8
9.. parsed-literal::
10
11    template<
12          typename Iterator
13        >
14    struct next
15    {
16        typedef |unspecified| type;
17    };
18
19
20
21Description
22-----------
23
24Returns the next iterator in the sequence. |Note:| ``next`` has a number of
25overloaded meanings, depending on the type of its argument. For instance,
26if ``X`` is an |Integral Constant|, ``next<X>`` returns an incremented
27|Integral Constant| of the same type. The following specification is
28iterator-specific. Please refer to the corresponding concept's
29documentation for the details of the alternative semantics |-- end note|.
30
31
32Header
33------
34
35.. parsed-literal::
36
37    #include <boost/mpl/next_prior.hpp>
38
39
40Parameters
41----------
42
43+---------------+---------------------------+-----------------------------------+
44| Parameter     | Requirement               | Description                       |
45+===============+===========================+===================================+
46| ``Iterator``  | |Forward Iterator|.       | An iterator to increment.         |
47+---------------+---------------------------+-----------------------------------+
48
49
50Expression semantics
51--------------------
52
53For 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
76Complexity
77----------
78
79Amortized constant time.
80
81
82Example
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
94See also
95--------
96
97|Iterators|, |begin| / |end|, |prior|, |deref|
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