1 .. Algorithms/Transformation Algorithms//sort |95
13 , typename Pred = less<_1,_2>
14 , typename In = |unspecified|
18 typedef |unspecified| type;
25 Returns a new sequence of all elements in the range |begin/end<Seq>| sorted according
26 to the ordering relation ``Pred``.
28 |transformation algorithm disclaimer|
36 #include <boost/mpl/sort.hpp>
42 |Reversible Algorithm|
48 +-------------------+-----------------------------------+-------------------------------+
49 | Parameter | Requirement | Description |
50 +===================+===================================+===============================+
51 | ``Seq`` | |Forward Sequence| | An original sequence. |
52 +-------------------+-----------------------------------+-------------------------------+
53 | ``Pred`` | Binary |Lambda Expression| | An ordering relation. |
54 +-------------------+-----------------------------------+-------------------------------+
55 | ``In`` | |Inserter| | An inserter. |
56 +-------------------+-----------------------------------+-------------------------------+
62 |Semantics disclaimer...| |Reversible Algorithm|.
64 For any |Forward Sequence| ``s``, a binary |Lambda Expression| ``pred``, and an
70 typedef sort<s,pred,in>::type r;
76 If ``size<s>::value <= 1``, equivalent to
80 typedef copy<s,in>::type r;
83 otherwise equivalent to
87 typedef back_inserter< vector<> > aux_in;
88 typedef lambda<pred>::type p;
90 typedef begin<s>::type pivot;
92 iterator_range< next<pivot>::type, end<s>::type >
93 , apply_wrap2<p,_1,deref<pivot>::type>
98 typedef sort<partitioned::first,p,aux_in >::type part1;
99 typedef sort<partitioned::second,p,aux_in >::type part2;
103 joint_view<part1,single_view< deref<pivot>::type > >
113 Average *O(n log(n))* where *n* == ``size<s>::value``, quadratic at worst.
120 typedef vector_c<int,3,4,0,-5,8,-1,7> numbers;
121 typedef vector_c<int,-5,-1,0,3,4,7,8> expected;
122 typedef sort<numbers>::type result;
124 BOOST_MPL_ASSERT(( equal< result, expected, equal_to<_,_> > ));
130 |Transformation Algorithms|, |Reversible Algorithm|, |partition|
133 .. copyright:: Copyright © 2001-2009 Aleksey Gurtovoy and David Abrahams
134 Distributed under the Boost Software License, Version 1.0. (See accompanying
135 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)