From Jason Turner

[push.heap]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpc_3psv4r/{from.md → to.md} +24 -7
tmp/tmpc_3psv4r/{from.md → to.md} RENAMED
@@ -1,21 +1,38 @@
1
  #### `push_heap` <a id="push.heap">[[push.heap]]</a>
2
 
3
  ``` cpp
4
  template<class RandomAccessIterator>
5
- void push_heap(RandomAccessIterator first, RandomAccessIterator last);
6
 
7
  template<class RandomAccessIterator, class Compare>
8
- void push_heap(RandomAccessIterator first, RandomAccessIterator last,
9
  Compare comp);
 
 
 
 
 
 
 
 
 
 
10
  ```
11
 
12
- *Requires:* The range \[`first`, `last - 1`) shall be a valid heap. The
13
- type of `*first` shall satisfy the `MoveConstructible` requirements
14
- (Table  [[tab:moveconstructible]]) and the `MoveAssignable` requirements
15
- (Table  [[tab:moveassignable]]).
 
 
 
 
16
 
17
  *Effects:* Places the value in the location `last - 1` into the
18
  resulting heap \[`first`, `last`).
19
 
20
- *Complexity:* At most log(`last - first`) comparisons.
 
 
 
21
 
 
1
  #### `push_heap` <a id="push.heap">[[push.heap]]</a>
2
 
3
  ``` cpp
4
  template<class RandomAccessIterator>
5
+ constexpr void push_heap(RandomAccessIterator first, RandomAccessIterator last);
6
 
7
  template<class RandomAccessIterator, class Compare>
8
+ constexpr void push_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::push_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::push_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 - 1`) is a valid heap with
26
+ respect to `comp` and `proj`. For the overloads in namespace `std`, the
27
+ type of `*first` meets the *Cpp17MoveConstructible* requirements
28
+ ([[cpp17.moveconstructible]]) and the *Cpp17MoveAssignable*
29
+ requirements ([[cpp17.moveassignable]]).
30
 
31
  *Effects:* Places the value in the location `last - 1` into the
32
  resulting heap \[`first`, `last`).
33
 
34
+ *Returns:* `last` for the overloads in namespace `ranges`.
35
+
36
+ *Complexity:* At most log(`last - first`) comparisons and twice as many
37
+ projections.
38