Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions std/algorithm/sorting.d
Original file line number Diff line number Diff line change
Expand Up @@ -3119,7 +3119,7 @@ if (isRandomAccessRange!(Range) && hasLength!Range && hasSlicing!Range)
// Workaround for https://issues.dlang.org/show_bug.cgi?id=16528
// Safety checks: enumerate all potentially unsafe generic primitives
// then use a @trusted implementation.
binaryFun!less(r[0], r[r.length - 1]);
cast(void) binaryFun!less(r[0], r[r.length - 1]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW this looks like unfinished work. This is in an if (false) block ...

import std.algorithm.mutation : swapAt;
r.swapAt(size_t(0), size_t(0));
static assert(is(typeof(r.length) == size_t));
Expand All @@ -3137,7 +3137,7 @@ if (isRandomAccessRange!(Range) && hasLength!Range && hasSlicing!Range)
topN!"a < b"(v, 100);
assert(v == [ 25, 7, 9, 2, 0, 5, 21 ]);
auto n = 4;
topN!"a < b"(v, n);
topN!((a, b) => a < b)(v, n);
assert(v[n] == 9);
}

Expand Down