1 .. Algorithms/Transformation Algorithms//stable_partition |90
14 , typename In1 = |unspecified|
15 , typename In2 = |unspecified|
17 struct stable_partition
19 typedef |unspecified| type;
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 ``stable_partition`` is guaranteed to preserve the relative order of the
29 elements in the resulting sequences.
32 |transformation algorithm disclaimer|
40 #include <boost/mpl/stable_partition.hpp>
46 |Reversible Algorithm|
52 +-------------------+-----------------------------------+-------------------------------+
53 | Parameter | Requirement | Description |
54 +===================+===================================+===============================+
55 | ``Seq`` | |Forward Sequence| | An original sequence. |
56 +-------------------+-----------------------------------+-------------------------------+
57 | ``Pred`` | Unary |Lambda Expression| | A partitioning predicate. |
58 +-------------------+-----------------------------------+-------------------------------+
59 | ``In1``, ``In2`` | |Inserter| | Output inserters. |
60 +-------------------+-----------------------------------+-------------------------------+
66 |Semantics disclaimer...| |Reversible Algorithm|.
68 For any |Forward Sequence| ``s``, an unary |Lambda Expression| ``pred``, and |Inserter|\ s
74 typedef stable_partition<s,pred,in1,in2>::type r;
84 typedef lambda<pred>::type p;
85 typedef lambda<in1::operation>::type in1_op;
86 typedef lambda<in2::operation>::type in2_op;
90 , pair< in1::state, in2::state >
92 apply_wrap\ ``1``\<p,_2>
93 , pair< apply_wrap\ ``2``\<in1_op,first<_1>,_2>, second<_1> >
94 , pair< first<_1>, apply_wrap\ ``2``\<in2_op,second<_1>,_2> >
102 Linear. Exactly ``size<s>::value`` applications of ``pred``, and ``size<s>::value``
103 of summarized ``in1::operation`` / ``in2::operation`` applications.
111 template< typename N > struct is_odd : bool_<(N::value % 2)> {};
113 typedef stable_partition<
116 , back_inserter< vector<> >
117 , back_inserter< vector<> >
120 BOOST_MPL_ASSERT(( equal< r::first, vector_c<int,1,3,5,7,9> > ));
121 BOOST_MPL_ASSERT(( equal< r::second, vector_c<int,0,2,4,6,8> > ));
127 |Transformation Algorithms|, |Reversible Algorithm|, |reverse_stable_partition|, |partition|, |sort|, |transform|
130 .. copyright:: Copyright © 2001-2009 Aleksey Gurtovoy and David Abrahams
131 Distributed under the Boost Software License, Version 1.0. (See accompanying
132 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)