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