Skip to content

Commit

Permalink
co-locate overloads of std.algorithm.mutation.swap() (#8951)
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright authored Oct 18, 2024
1 parent 1ea91e6 commit a51c0ea
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions std/algorithm/mutation.d
Original file line number Diff line number Diff line change
Expand Up @@ -2860,6 +2860,13 @@ 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);
}

/// ditto
void swap(T)(ref T lhs, ref T rhs) @trusted pure nothrow @nogc
if (isBlitAssignable!T && !is(typeof(lhs.proxySwap(rhs))))
{
Expand Down Expand Up @@ -3121,13 +3128,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`.
Expand Down

0 comments on commit a51c0ea

Please sign in to comment.