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