• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1.. Algorithms/Transformation Algorithms//reverse |100
2
3reverse
4=======
5
6Synopsis
7--------
8
9.. parsed-literal::
10
11    template<
12          typename Sequence
13        , typename In = |unspecified|
14        >
15    struct reverse
16    {
17        typedef |unspecified| type;
18    };
19
20
21
22Description
23-----------
24
25Returns a reversed copy of the original sequence. ``reverse`` is a synonym for
26|reverse_copy|.
27
28|transformation algorithm disclaimer|
29
30Header
31------
32
33.. parsed-literal::
34
35    #include <boost/mpl/reverse.hpp>
36
37
38Parameters
39----------
40
41+---------------+-----------------------------------+-------------------------------+
42| Parameter     | Requirement                       | Description                   |
43+===============+===================================+===============================+
44| ``Sequence``  | |Forward Sequence|                | A sequence to reverse.        |
45+---------------+-----------------------------------+-------------------------------+
46| ``In``        | |Inserter|                        | An inserter.                  |
47+---------------+-----------------------------------+-------------------------------+
48
49
50Expression semantics
51--------------------
52
53For any |Forward Sequence| ``s``, and an |Inserter| ``in``:
54
55.. parsed-literal::
56
57    typedef reverse<s,in>::type r;
58
59:Return type:
60    A type.
61
62:Semantics:
63    Equivalent to
64
65    .. parsed-literal::
66
67        typedef reverse_copy<s,in>::type r;
68
69
70Complexity
71----------
72
73Linear.
74
75
76Example
77-------
78
79.. parsed-literal::
80
81    typedef vector_c<int,9,8,7,6,5,4,3,2,1,0> numbers;
82    typedef reverse< numbers >::type result;
83
84    BOOST_MPL_ASSERT(( equal< result, range_c<int,0,10> > ));
85
86
87See also
88--------
89
90|Transformation Algorithms|, |Reversible Algorithm|, |reverse_copy|, |copy|, |copy_if|
91
92
93.. copyright:: Copyright �  2001-2009 Aleksey Gurtovoy and David Abrahams
94   Distributed under the Boost Software License, Version 1.0. (See accompanying
95   file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
96