From Jason Turner

[sort.heap]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp4dqrdt6i/{from.md → to.md} +27 -10
tmp/tmp4dqrdt6i/{from.md → to.md} RENAMED
@@ -1,22 +1,39 @@
1
  #### `sort_heap` <a id="sort.heap">[[sort.heap]]</a>
2
 
3
  ``` cpp
4
  template<class RandomAccessIterator>
5
- void sort_heap(RandomAccessIterator first, RandomAccessIterator last);
6
 
7
  template<class RandomAccessIterator, class Compare>
8
- void sort_heap(RandomAccessIterator first, RandomAccessIterator last,
9
  Compare comp);
 
 
 
 
 
 
 
 
 
 
10
  ```
11
 
12
- *Requires:* The range \[`first`, `last`) shall be a valid heap.
13
- `RandomAccessIterator` shall satisfy the requirements of
14
- `ValueSwappable` ([[swappable.requirements]]). The type of `*first`
15
- shall satisfy the requirements of `MoveConstructible`
16
- (Table  [[tab:moveconstructible]]) and of `MoveAssignable`
17
- (Table  [[tab:moveassignable]]).
18
 
19
- *Effects:* Sorts elements in the heap \[`first`, `last`).
 
 
 
 
 
20
 
21
- *Complexity:* At most N log N comparisons, where N = `last - first`.
 
 
 
 
 
 
22
 
 
1
  #### `sort_heap` <a id="sort.heap">[[sort.heap]]</a>
2
 
3
  ``` cpp
4
  template<class RandomAccessIterator>
5
+ constexpr void sort_heap(RandomAccessIterator first, RandomAccessIterator last);
6
 
7
  template<class RandomAccessIterator, class Compare>
8
+ constexpr void sort_heap(RandomAccessIterator first, RandomAccessIterator last,
9
  Compare comp);
10
+
11
+ template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
12
+ class Proj = identity>
13
+ requires sortable<I, Comp, Proj>
14
+ constexpr I
15
+ ranges::sort_heap(I first, S last, Comp comp = {}, Proj proj = {});
16
+ template<random_access_range R, class Comp = ranges::less, class Proj = identity>
17
+ requires sortable<iterator_t<R>, Comp, Proj>
18
+ constexpr borrowed_iterator_t<R>
19
+ ranges::sort_heap(R&& r, Comp comp = {}, Proj proj = {});
20
  ```
21
 
22
+ Let `comp` be `less{}` and `proj` be `identity{}` for the overloads with
23
+ no parameters by those names.
 
 
 
 
24
 
25
+ *Preconditions:* The range \[`first`, `last`) is a valid heap with
26
+ respect to `comp` and `proj`. For the overloads in namespace `std`,
27
+ `RandomAccessIterator` meets the *Cpp17ValueSwappable*
28
+ requirements [[swappable.requirements]] and the type of `*first` meets
29
+ the *Cpp17MoveConstructible* ([[cpp17.moveconstructible]]) and
30
+ *Cpp17MoveAssignable* ([[cpp17.moveassignable]]) requirements.
31
 
32
+ *Effects:* Sorts elements in the heap \[`first`, `last`) with respect to
33
+ `comp` and `proj`.
34
+
35
+ *Returns:* `last` for the overloads in namespace `ranges`.
36
+
37
+ *Complexity:* At most 2N log N comparisons, where N = `last - first`,
38
+ and twice as many projections.
39