From Jason Turner

[stable.sort]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp0pby74ru/{from.md → to.md} +26 -9
tmp/tmp0pby74ru/{from.md → to.md} RENAMED
@@ -12,20 +12,37 @@ template<class RandomAccessIterator, class Compare>
12
  Compare comp);
13
  template<class ExecutionPolicy, class RandomAccessIterator, class Compare>
14
  void stable_sort(ExecutionPolicy&& exec,
15
  RandomAccessIterator first, RandomAccessIterator last,
16
  Compare comp);
 
 
 
 
 
 
 
 
 
17
  ```
18
 
19
- *Requires:* `RandomAccessIterator` shall satisfy the requirements of
20
- `ValueSwappable` ([[swappable.requirements]]). The type of `*first`
21
- shall satisfy the requirements of `MoveConstructible`
22
- (Table  [[tab:moveconstructible]]) and of `MoveAssignable`
23
- (Table  [[tab:moveassignable]]).
24
 
25
- *Effects:* Sorts the elements in the range \[`first`, `last`).
 
 
 
 
26
 
27
- *Complexity:* At most N log²(N) comparisons, where N = `last - first`,
28
- but only N log N comparisons if there is enough extra memory.
29
 
30
- *Remarks:* Stable ([[algorithm.stable]]).
 
 
 
 
 
 
 
31
 
 
12
  Compare comp);
13
  template<class ExecutionPolicy, class RandomAccessIterator, class Compare>
14
  void stable_sort(ExecutionPolicy&& exec,
15
  RandomAccessIterator first, RandomAccessIterator last,
16
  Compare comp);
17
+
18
+ template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
19
+ class Proj = identity>
20
+ requires sortable<I, Comp, Proj>
21
+ I ranges::stable_sort(I first, S last, Comp comp = {}, Proj proj = {});
22
+ template<random_access_range R, class Comp = ranges::less, class Proj = identity>
23
+ requires sortable<iterator_t<R>, Comp, Proj>
24
+ borrowed_iterator_t<R>
25
+ ranges::stable_sort(R&& r, Comp comp = {}, Proj proj = {});
26
  ```
27
 
28
+ Let `comp` be `less{}` and `proj` be `identity{}` for the overloads with
29
+ no parameters by those names.
 
 
 
30
 
31
+ *Preconditions:* For the overloads in namespace `std`,
32
+ `RandomAccessIterator` meets the *Cpp17ValueSwappable*
33
+ requirements [[swappable.requirements]] and the type of `*first` meets
34
+ the *Cpp17MoveConstructible* ([[cpp17.moveconstructible]]) and
35
+ *Cpp17MoveAssignable* ([[cpp17.moveassignable]]) requirements.
36
 
37
+ *Effects:* Sorts the elements in the range \[`first`, `last`) with
38
+ respect to `comp` and `proj`.
39
 
40
+ *Returns:* `last` for the overloads in namespace `ranges`.
41
+
42
+ *Complexity:* Let N be `last - first`. If enough extra memory is
43
+ available, N log(N) comparisons. Otherwise, at most N log²(N)
44
+ comparisons. In either case, twice as many projections as the number of
45
+ comparisons.
46
+
47
+ *Remarks:* Stable [[algorithm.stable]].
48