2 Copyright 2010 Neil Groves
3 Distributed under the Boost Software License, Version 1.0.
4 (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
11 template<class RandomAccessRange>
12 RandomAccessRange& sort(RandomAccessRange& rng);
14 template<class RandomAccessRange>
15 const RandomAccessRange& sort(const RandomAccessRange& rng);
17 template<class RandomAccessRange, class BinaryPredicate>
18 RandomAccessRange& sort(RandomAccessRange& rng, BinaryPredicate pred);
20 template<class RandomAccessRange, class BinaryPredicate>
21 const RandomAccessRange& sort(const RandomAccessRange& rng, BinaryPredicate pred);
26 `sort` sorts the elements in `rng` into ascending order. `sort` is not guaranteed to be stable. Returns the sorted range.
28 For versions of the `sort` function without a predicate, ascending order is defined by `operator<()` such that for all adjacent elements `[x,y]`, `y < x == false`.
30 For versions of the `sort` function with a predicate, ascending order is defined by `pred` such that for all adjacent elements `[x,y]`, `pred(y, x) == false`.
34 Defined in the header file `boost/range/algorithm/sort.hpp`
36 [heading Requirements]
38 [*For versions of sort without a predicate:]
40 * `RandomAccessRange` is a model of the __random_access_range__ Concept.
41 * `RandomAccessRange` is mutable.
42 * `RandomAccessRange`'s value type is a model of the `LessThanComparableConcept`.
43 * The ordering relation on `RandomAccessRange`'s value type is a [*strict weak ordering], as defined in the `LessThanComparableConcept` requirements.
45 [*For versions of sort with a predicate]
47 * `RandomAccessRange` is a model of the __random_access_range__ Concept.
48 * `RandomAccessRange` is mutable.
49 * `BinaryPredicate` is a model of the `StrictWeakOrderingConcept`.
50 * `RandomAccessRange`'s value type is convertible to both of `BinaryPredicate`'s argument types.
54 `O(N log(N))` comparisons (both average and worst-case), where `N` is `distance(rng)`.