From 96ece512a24e9bc2e45389a6bc29000e47a808a6 Mon Sep 17 00:00:00 2001 From: Andrei Alexandrescu Date: Fri, 15 Jan 2016 12:26:05 -0500 Subject: [PATCH] Use member syntax for swapAt to give the range a chance to intercept it --- std/algorithm/sorting.d | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/std/algorithm/sorting.d b/std/algorithm/sorting.d index 1e2753cac..8ce4fe154 100644 --- a/std/algorithm/sorting.d +++ b/std/algorithm/sorting.d @@ -1276,7 +1276,7 @@ package(std) template HeapOps(alias less, Range) // Sort for (size_t i = r.length - 1; i > 0; --i) { - swapAt(r, 0, i); + r.swapAt(0, i); siftDown(r, 0, i); } } @@ -1332,7 +1332,7 @@ package(std) template HeapOps(alias less, Range) auto child1 = child + 1; if (child1 < end && lessFun(r[child], r[child1])) child = child1; - swapAt(r, parent, child); + r.swapAt(parent, child); parent = child; } @@ -1344,7 +1344,7 @@ package(std) template HeapOps(alias less, Range) parent = (child - 1) / 2; if(lessFun(r[parent], r[child])) { - swapAt(r, parent, child); + r.swapAt(parent, child); child = parent; } else break;