mirror of
https://github.com/dlang/phobos.git
synced 2025-05-02 08:00:48 +03:00
Better safety checks
This commit is contained in:
parent
9a8bf131d9
commit
9778872ffa
1 changed files with 2 additions and 1 deletions
|
@ -2947,10 +2947,11 @@ auto topN(alias less = "a < b",
|
|||
// Workaround for https://issues.dlang.org/show_bug.cgi?id=16528
|
||||
// Safety checks: enumerate all potentially unsafe generic primitives
|
||||
// then use a @trusted implementation.
|
||||
r = r[0 .. $];
|
||||
auto b = binaryFun!less(r[0], r[$ - 1]);
|
||||
import std.algorithm.mutation : swapAt;
|
||||
r.swapAt(size_t(0), size_t(0));
|
||||
static assert(is(typeof(r.length) == size_t));
|
||||
size_t unused = r.length;
|
||||
pivotPartition!less(r, 0);
|
||||
}
|
||||
bool useSampling = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue