mirror of
https://github.com/dlang/phobos.git
synced 2025-05-06 02:45:12 +03:00
Fix safety checks
This commit is contained in:
parent
9778872ffa
commit
9ad4f0d227
1 changed files with 3 additions and 1 deletions
|
@ -2948,10 +2948,12 @@ auto topN(alias less = "a < b",
|
||||||
// Safety checks: enumerate all potentially unsafe generic primitives
|
// Safety checks: enumerate all potentially unsafe generic primitives
|
||||||
// then use a @trusted implementation.
|
// then use a @trusted implementation.
|
||||||
r = r[0 .. $];
|
r = r[0 .. $];
|
||||||
|
r = r[0 .. $ - 1];
|
||||||
auto b = binaryFun!less(r[0], r[$ - 1]);
|
auto b = binaryFun!less(r[0], r[$ - 1]);
|
||||||
import std.algorithm.mutation : swapAt;
|
import std.algorithm.mutation : swapAt;
|
||||||
r.swapAt(size_t(0), size_t(0));
|
r.swapAt(size_t(0), size_t(0));
|
||||||
size_t unused = r.length;
|
auto len = r.length;
|
||||||
|
static assert(is(typeof(len) == size_t));
|
||||||
pivotPartition!less(r, 0);
|
pivotPartition!less(r, 0);
|
||||||
}
|
}
|
||||||
bool useSampling = true;
|
bool useSampling = true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue