tmp/tmp655ojzgh/{from.md → to.md}
RENAMED
|
@@ -1,40 +1,65 @@
|
|
| 1 |
#### `partial_sort` <a id="partial.sort">[[partial.sort]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
template<class RandomAccessIterator>
|
| 5 |
-
void partial_sort(RandomAccessIterator first,
|
| 6 |
RandomAccessIterator middle,
|
| 7 |
RandomAccessIterator last);
|
| 8 |
template<class ExecutionPolicy, class RandomAccessIterator>
|
| 9 |
void partial_sort(ExecutionPolicy&& exec,
|
| 10 |
RandomAccessIterator first,
|
| 11 |
RandomAccessIterator middle,
|
| 12 |
RandomAccessIterator last);
|
| 13 |
|
| 14 |
template<class RandomAccessIterator, class Compare>
|
| 15 |
-
void partial_sort(RandomAccessIterator first,
|
| 16 |
RandomAccessIterator middle,
|
| 17 |
RandomAccessIterator last,
|
| 18 |
Compare comp);
|
| 19 |
template<class ExecutionPolicy, class RandomAccessIterator, class Compare>
|
| 20 |
void partial_sort(ExecutionPolicy&& exec,
|
| 21 |
RandomAccessIterator first,
|
| 22 |
RandomAccessIterator middle,
|
| 23 |
RandomAccessIterator last,
|
| 24 |
Compare comp);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
```
|
| 26 |
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
shall satisfy the requirements of `MoveConstructible`
|
| 30 |
-
(Table [[tab:moveconstructible]]) and of `MoveAssignable`
|
| 31 |
-
(Table [[tab:moveassignable]]).
|
| 32 |
|
| 33 |
-
*
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
*Complexity:* Approximately `(last - first) * log(middle - first)`
|
| 39 |
-
comparisons.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
|
|
|
|
| 1 |
#### `partial_sort` <a id="partial.sort">[[partial.sort]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
template<class RandomAccessIterator>
|
| 5 |
+
constexpr void partial_sort(RandomAccessIterator first,
|
| 6 |
RandomAccessIterator middle,
|
| 7 |
RandomAccessIterator last);
|
| 8 |
template<class ExecutionPolicy, class RandomAccessIterator>
|
| 9 |
void partial_sort(ExecutionPolicy&& exec,
|
| 10 |
RandomAccessIterator first,
|
| 11 |
RandomAccessIterator middle,
|
| 12 |
RandomAccessIterator last);
|
| 13 |
|
| 14 |
template<class RandomAccessIterator, class Compare>
|
| 15 |
+
constexpr void partial_sort(RandomAccessIterator first,
|
| 16 |
RandomAccessIterator middle,
|
| 17 |
RandomAccessIterator last,
|
| 18 |
Compare comp);
|
| 19 |
template<class ExecutionPolicy, class RandomAccessIterator, class Compare>
|
| 20 |
void partial_sort(ExecutionPolicy&& exec,
|
| 21 |
RandomAccessIterator first,
|
| 22 |
RandomAccessIterator middle,
|
| 23 |
RandomAccessIterator last,
|
| 24 |
Compare comp);
|
| 25 |
+
|
| 26 |
+
template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
|
| 27 |
+
class Proj = identity>
|
| 28 |
+
requires sortable<I, Comp, Proj>
|
| 29 |
+
constexpr I
|
| 30 |
+
ranges::partial_sort(I first, I middle, S last, Comp comp = {}, Proj proj = {});
|
| 31 |
```
|
| 32 |
|
| 33 |
+
Let `comp` be `less{}` and `proj` be `identity{}` for the overloads with
|
| 34 |
+
no parameters by those names.
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
+
*Preconditions:* \[`first`, `middle`) and \[`middle`, `last`) are valid
|
| 37 |
+
ranges. For the overloads in namespace `std`, `RandomAccessIterator`
|
| 38 |
+
meets the *Cpp17ValueSwappable* requirements [[swappable.requirements]]
|
| 39 |
+
and the type of `*first` meets the *Cpp17MoveConstructible*
|
| 40 |
+
([[cpp17.moveconstructible]]) and *Cpp17MoveAssignable*
|
| 41 |
+
([[cpp17.moveassignable]]) requirements.
|
| 42 |
+
|
| 43 |
+
*Effects:* Places the first `middle - first` elements from the range
|
| 44 |
+
\[`first`, `last`) as sorted with respect to `comp` and `proj` into the
|
| 45 |
+
range \[`first`, `middle`). The rest of the elements in the range
|
| 46 |
+
\[`middle`, `last`) are placed in an unspecified order.
|
| 47 |
+
|
| 48 |
+
*Returns:* `last` for the overload in namespace `ranges`.
|
| 49 |
|
| 50 |
*Complexity:* Approximately `(last - first) * log(middle - first)`
|
| 51 |
+
comparisons, and twice as many projections.
|
| 52 |
+
|
| 53 |
+
``` cpp
|
| 54 |
+
template<random_access_range R, class Comp = ranges::less, class Proj = identity>
|
| 55 |
+
requires sortable<iterator_t<R>, Comp, Proj>
|
| 56 |
+
constexpr borrowed_iterator_t<R>
|
| 57 |
+
ranges::partial_sort(R&& r, iterator_t<R> middle, Comp comp = {}, Proj proj = {});
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
*Effects:* Equivalent to:
|
| 61 |
+
|
| 62 |
+
``` cpp
|
| 63 |
+
return ranges::partial_sort(ranges::begin(r), middle, ranges::end(r), comp, proj);
|
| 64 |
+
```
|
| 65 |
|