Skip to content

Commit

Permalink
Use member syntax for swapAt to give the range a chance to intercept it
Browse files Browse the repository at this point in the history
  • Loading branch information
andralex committed Jan 15, 2016
1 parent c12573a commit 96ece51
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions std/algorithm/sorting.d
Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -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;
}

Expand All @@ -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;
Expand Down

0 comments on commit 96ece51

Please sign in to comment.