]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/mpl/doc/src/refmanual/reverse_partition.rst
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / mpl / doc / src / refmanual / reverse_partition.rst
1 .. Algorithms/Transformation Algorithms//reverse_partition |185
2
3 reverse_partition
4 =================
5
6 Synopsis
7 --------
8
9 .. parsed-literal::
10
11 template<
12 typename Seq
13 , typename Pred
14 , typename In1 = |unspecified|
15 , typename In2 = |unspecified|
16 >
17 struct reverse_partition
18 {
19 typedef |unspecified| type;
20 };
21
22
23 Description
24 -----------
25
26 Returns a pair of sequences together containing all elements in the range
27 |begin/end<Seq>| split into two groups based on the predicate ``Pred``.
28 ``reverse_partition`` is a synonym for |reverse_stable_partition|.
29
30 |transformation algorithm disclaimer|
31
32
33 Header
34 ------
35
36 .. parsed-literal::
37
38 #include <boost/mpl/partition.hpp>
39
40
41 Model of
42 --------
43
44 |Reversible Algorithm|
45
46
47 Parameters
48 ----------
49
50 +-------------------+-----------------------------------+-------------------------------+
51 | Parameter | Requirement | Description |
52 +===================+===================================+===============================+
53 | ``Seq`` | |Forward Sequence| | An original sequence. |
54 +-------------------+-----------------------------------+-------------------------------+
55 | ``Pred`` | Unary |Lambda Expression| | A partitioning predicate. |
56 +-------------------+-----------------------------------+-------------------------------+
57 | ``In1``, ``In2`` | |Inserter| | Output inserters. |
58 +-------------------+-----------------------------------+-------------------------------+
59
60
61 Expression semantics
62 --------------------
63
64 |Semantics disclaimer...| |Reversible Algorithm|.
65
66 For any |Forward Sequence| ``s``, an unary |Lambda Expression| ``pred``, and |Inserter|\ s
67 ``in1`` and ``in2``:
68
69
70 .. parsed-literal::
71
72 typedef reverse_partition<s,pred,in1,in2>::type r;
73
74 :Return type:
75 A |pair|.
76
77 :Semantics:
78 Equivalent to
79
80 .. parsed-literal::
81
82 typedef reverse_stable_partition<s,pred,in1,in2>::type r;
83
84
85 Complexity
86 ----------
87
88 Linear. Exactly ``size<s>::value`` applications of ``pred``, and ``size<s>::value``
89 of summarized ``in1::operation`` / ``in2::operation`` applications.
90
91
92 Example
93 -------
94
95 .. parsed-literal::
96
97 template< typename N > struct is_odd : bool_<(N::value % 2)> {};
98
99 typedef partition<
100 range_c<int,0,10>
101 , is_odd<_1>
102 , back_inserter< vector<> >
103 , back_inserter< vector<> >
104 >::type r;
105
106 BOOST_MPL_ASSERT(( equal< r::first, vector_c<int,9,7,5,3,1> > ));
107 BOOST_MPL_ASSERT(( equal< r::second, vector_c<int,8,6,4,2,0> > ));
108
109
110 See also
111 --------
112
113 |Transformation Algorithms|, |Reversible Algorithm|, |partition|, |reverse_stable_partition|, |sort|
114
115
116 .. copyright:: Copyright © 2001-2009 Aleksey Gurtovoy and David Abrahams
117 Distributed under the Boost Software License, Version 1.0. (See accompanying
118 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)