Brian Silverman | 598d029 | 2018-08-04 23:56:47 -0700 | [diff] [blame^] | 1 | [/ |
| 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) |
| 5 | /] |
| 6 | [section:pop_heap pop_heap] |
| 7 | |
| 8 | [heading Prototype] |
| 9 | |
| 10 | `` |
| 11 | template<class RandomAccessRange> |
| 12 | RandomAccessRange& pop_heap(RandomAccessRange& rng); |
| 13 | |
| 14 | template<class RandomAccessRange> |
| 15 | const RandomAccessRange& pop_heap(const RandomAccessRange& rng); |
| 16 | |
| 17 | template<class RandomAccessRange, class Compare> |
| 18 | RandomAccessRange& pop_heap(RandomAccessRange& rng, Compare pred); |
| 19 | |
| 20 | template<class RandomAccessRange, class Compare> |
| 21 | const RandomAccessRange& pop_heap(const RandomAccessRange& rng, Compare pred); |
| 22 | `` |
| 23 | |
| 24 | [heading Description] |
| 25 | |
| 26 | `pop_heap` removes the largest element from the heap. It is assumed that `begin(rng), prior(end(rng))` is already a heap (and therefore the largest element is `*begin(rng)`). |
| 27 | |
| 28 | The ordering relationship is determined by using `operator<` in the non-predicate versions, and by evaluating `pred` in the predicate versions. |
| 29 | |
| 30 | [heading Definition] |
| 31 | |
| 32 | Defined in the header file `boost/range/algorithm/heap_algorithm.hpp` |
| 33 | |
| 34 | [heading Requirements] |
| 35 | |
| 36 | [*For the non-predicate versions:] |
| 37 | |
| 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. |
| 42 | |
| 43 | [*For the predicate versions:] |
| 44 | |
| 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. |
| 49 | |
| 50 | [heading Precondition:] |
| 51 | |
| 52 | * `!empty(rng)` |
| 53 | * `rng` is a heap. |
| 54 | |
| 55 | [heading Complexity] |
| 56 | |
| 57 | Logarithmic. At most `2 * log(distance(rng))` comparisons. |
| 58 | |
| 59 | [endsect] |
| 60 | |
| 61 | |