Skip to content

Commit

Permalink
merge overloads of std.algorithm.mutation.swap()
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright committed Mar 18, 2024
1 parent 6fa90fe commit 41a1d0f
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions std/algorithm/mutation.d
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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`.
Expand Down

0 comments on commit 41a1d0f

Please sign in to comment.