tmp/tmpxftdchtw/{from.md → to.md}
RENAMED
|
@@ -20,10 +20,14 @@ template<class ExecutionPolicy, class RandomAccessIterator, class Compare>
|
|
| 20 |
template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
|
| 21 |
class Proj = identity>
|
| 22 |
requires sortable<I, Comp, Proj>
|
| 23 |
constexpr I
|
| 24 |
ranges::nth_element(I first, I nth, S last, Comp comp = {}, Proj proj = {});
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
```
|
| 26 |
|
| 27 |
Let `comp` be `less{}` and `proj` be `identity{}` for the overloads with
|
| 28 |
no parameters by those names.
|
| 29 |
|
|
@@ -41,13 +45,13 @@ Also for every iterator `i` in the range \[`first`, `nth`) and every
|
|
| 41 |
iterator `j` in the range \[`nth`, `last`) it holds that:
|
| 42 |
`bool(invoke(comp, invoke(proj, *j), invoke(proj, *i)))` is `false`.
|
| 43 |
|
| 44 |
*Returns:* `last` for the overload in namespace `ranges`.
|
| 45 |
|
| 46 |
-
*Complexity:* For the
|
| 47 |
-
average. For the
|
| 48 |
-
|
| 49 |
|
| 50 |
``` cpp
|
| 51 |
template<random_access_range R, class Comp = ranges::less, class Proj = identity>
|
| 52 |
requires sortable<iterator_t<R>, Comp, Proj>
|
| 53 |
constexpr borrowed_iterator_t<R>
|
|
@@ -58,5 +62,20 @@ template<random_access_range R, class Comp = ranges::less, class Proj = identity
|
|
| 58 |
|
| 59 |
``` cpp
|
| 60 |
return ranges::nth_element(ranges::begin(r), nth, ranges::end(r), comp, proj);
|
| 61 |
```
|
| 62 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
|
| 21 |
class Proj = identity>
|
| 22 |
requires sortable<I, Comp, Proj>
|
| 23 |
constexpr I
|
| 24 |
ranges::nth_element(I first, I nth, S last, Comp comp = {}, Proj proj = {});
|
| 25 |
+
template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
|
| 26 |
+
class Comp = ranges::less, class Proj = identity>
|
| 27 |
+
requires sortable<I, Comp, Proj>
|
| 28 |
+
I ranges::nth_element(Ep&& exec, I first, I nth, S last, Comp comp = {}, Proj proj = {});
|
| 29 |
```
|
| 30 |
|
| 31 |
Let `comp` be `less{}` and `proj` be `identity{}` for the overloads with
|
| 32 |
no parameters by those names.
|
| 33 |
|
|
|
|
| 45 |
iterator `j` in the range \[`nth`, `last`) it holds that:
|
| 46 |
`bool(invoke(comp, invoke(proj, *j), invoke(proj, *i)))` is `false`.
|
| 47 |
|
| 48 |
*Returns:* `last` for the overload in namespace `ranges`.
|
| 49 |
|
| 50 |
+
*Complexity:* For the non-parallel algorithm overloads, linear on
|
| 51 |
+
average. For the parallel algorithm overloads, 𝑂(N) applications of the
|
| 52 |
+
predicate, and 𝑂(N log N) swaps, where N = `last - first`.
|
| 53 |
|
| 54 |
``` cpp
|
| 55 |
template<random_access_range R, class Comp = ranges::less, class Proj = identity>
|
| 56 |
requires sortable<iterator_t<R>, Comp, Proj>
|
| 57 |
constexpr borrowed_iterator_t<R>
|
|
|
|
| 62 |
|
| 63 |
``` cpp
|
| 64 |
return ranges::nth_element(ranges::begin(r), nth, ranges::end(r), comp, proj);
|
| 65 |
```
|
| 66 |
|
| 67 |
+
``` cpp
|
| 68 |
+
template<execution-policy Ep, sized-random-access-range R, class Comp = ranges::less,
|
| 69 |
+
class Proj = identity>
|
| 70 |
+
requires sortable<iterator_t<R>, Comp, Proj>
|
| 71 |
+
borrowed_iterator_t<R>
|
| 72 |
+
ranges::nth_element(Ep&& exec, R&& r, iterator_t<R> nth, Comp comp = {}, Proj proj = {});
|
| 73 |
+
```
|
| 74 |
+
|
| 75 |
+
*Effects:* Equivalent to:
|
| 76 |
+
|
| 77 |
+
``` cpp
|
| 78 |
+
return ranges::nth_element(std::forward<Ep>(exec), ranges::begin(r), nth, ranges::end(r),
|
| 79 |
+
comp, proj);
|
| 80 |
+
```
|
| 81 |
+
|