diff --git a/std/algorithm/mutation.d b/std/algorithm/mutation.d index fbef28e5d56..36ba20d2f6b 100644 --- a/std/algorithm/mutation.d +++ b/std/algorithm/mutation.d @@ -2837,8 +2837,15 @@ Params: lhs = Data to be swapped with `rhs`. rhs = Data to be swapped with `lhs`. */ +void swap(T)(ref T lhs, ref T rhs) + if (is(typeof(lhs.proxySwap(rhs)))) +{ + lhs.proxySwap(rhs); +} + void swap(T)(ref T lhs, ref T rhs) @trusted pure nothrow @nogc -if (isBlitAssignable!T && !is(typeof(lhs.proxySwap(rhs)))) + if (isBlitAssignable!T && + !is(typeof(lhs.proxySwap(rhs)))) { import std.traits : hasAliasing, hasElaborateAssign, isAssignable, isStaticArray; @@ -3098,13 +3105,6 @@ if (isBlitAssignable!T && !is(typeof(lhs.proxySwap(rhs)))) swap(a3, a4); } -/// ditto -void swap(T)(ref T lhs, ref T rhs) -if (is(typeof(lhs.proxySwap(rhs)))) -{ - lhs.proxySwap(rhs); -} - /** Swaps two elements in-place of a range `r`, specified by their indices `i1` and `i2`.