Skip to content

Commit

Permalink
Merge pull request #4737 from John-Colvin/patch-17
Browse files Browse the repository at this point in the history
Fix Issue 16413 - multiSort doesn't work with @System comparison function
  • Loading branch information
andralex committed Aug 27, 2016
2 parents 9abe256 + 7c7af21 commit 45eb00f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions std/algorithm/sorting.d
Expand Up @@ -999,6 +999,14 @@ private void multiSortImpl(Range, SwapStrategy ss, funs...)(Range r)
assert(arr == [[1, 0], [1, 1], [1, 2], [2, 0]]);
}

unittest //Issue 16413 - @system comparison function
{
bool lt(int a, int b) { return a < b; } static @system
auto a = [2, 1];
a.multiSort!(lt, lt);
assert(a == [1, 2]);
}

private size_t getPivot(alias less, Range)(Range r)
{
import std.algorithm.mutation : swapAt;
Expand Down

0 comments on commit 45eb00f

Please sign in to comment.