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)
6 [section:sort_heap sort_heap]
11 template<class RandomAccessRange>
12 RandomAccessRange& sort_heap(RandomAccessRange& rng);
14 template<class RandomAccessRange>
15 const RandomAccessRange& sort_heap(const RandomAccessRange& rng);
17 template<class RandomAccessRange, class Compare>
18 RandomAccessRange& sort_heap(RandomAccessRange& rng, Compare pred);
20 template<class RandomAccessRange, class Compare>
21 const RandomAccessRange& sort_heap(const RandomAccessRange& rng, Compare pred);
26 `sort_heap` turns a heap into a sorted range.
28 The ordering relationship is determined by using `operator<` in the non-predicate versions, and by evaluating `pred` in the predicate versions.
32 Defined in the header file `boost/range/algorithm/heap_algorithm.hpp`
34 [heading Requirements]
36 [*For the non-predicate versions:]
38 * `RandomAccessRange` is a model of the __random_access_range__ Concept.
39 * `RandomAccessRange` is mutable.
40 * `RandomAccessRange`'s value type is a model of the `LessThanComparableConcept`.
41 * The ordering of objects of type `RandomAccessRange`'s value type is a [*/strict weak ordering/], as defined in the `LessThanComparableConcept` requirements.
43 [*For the predicate versions:]
45 * `RandomAccessRange` is a model of the __random_access_range__ Concept.
46 * `RandomAccessRange` is mutable.
47 * `Compare` is a model of the `StrictWeakOrderingConcept`.
48 * `RandomAccessRange`'s value type is convertible to both of `Compare`'s argument types.
50 [heading Precondition:]
56 At most `N * log(N)` comparisons, where `N` is `distance(rng)`.