1.. Iterators/Iterator Metafunctions//prior |40
2
3prior
4=====
5
6Synopsis
7--------
8
9.. parsed-literal::
10
11    template<
12          typename Iterator
13        >
14    struct prior
15    {
16        typedef |unspecified| type;
17    };
18
19
20
21Description
22-----------
23
24Returns the previous iterator in the sequence. |Note:| ``prior`` has a number of
25overloaded meanings, depending on the type of its argument. For instance,
26if ``X`` is an |Integral Constant|, ``prior<X>`` returns an decremented
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``  | |Bidirectional Iterator|. | An iterator to decrement.         |
47+---------------+---------------------------+-----------------------------------+
48
49
50Expression semantics
51--------------------
52
53For any |Bidirectional Iterator|\ s ``iter``:
54
55
56.. parsed-literal::
57
58    typedef prior<iter>::type j;
59
60:Return type:
61    |Bidirectional Iterator|.
62
63:Precondition:
64    ``iter`` is decrementable.
65
66:Semantics:
67    ``j`` is an iterator pointing to the previous element in the sequence.
68    If ``iter`` is a user-defined iterator, the library-provided default
69    implementation is equivalent to
70
71    .. parsed-literal::
72
73        typedef iter::prior 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< prior<last>::type, first > ));
92
93
94See also
95--------
96
97|Iterators|, |begin| / |end|, |next|, |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