]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/mpl/doc/src/refmanual/reverse_partition.rst
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / mpl / doc / src / refmanual / reverse_partition.rst
CommitLineData
7c673cae
FG
1.. Algorithms/Transformation Algorithms//reverse_partition |185
2
3reverse_partition
4=================
5
6Synopsis
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
23Description
24-----------
25
26Returns 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
33Header
34------
35
36.. parsed-literal::
37
38 #include <boost/mpl/partition.hpp>
39
40
41Model of
42--------
43
44|Reversible Algorithm|
45
46
47Parameters
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
61Expression semantics
62--------------------
63
64|Semantics disclaimer...| |Reversible Algorithm|.
65
66For 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
85Complexity
86----------
87
88Linear. Exactly ``size<s>::value`` applications of ``pred``, and ``size<s>::value``
89of summarized ``in1::operation`` / ``in2::operation`` applications.
90
91
92Example
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
110See also
111--------
112
113|Transformation Algorithms|, |Reversible Algorithm|, |partition|, |reverse_stable_partition|, |sort|
114
115
116