swap
fn
void swap(T)(ref T lhs, ref T rhs) if (is(typeof(lhs.proxySwap(rhs))))Swaps lhs and rhs. The instances lhs and rhs are moved in memory, without ever calling opAssign, nor any other function. T need not be assignable at all to be swapped.
If lhs and rhs reference the same instance, then nothing is done.
lhs and rhs must be mutable. If T is a struct or union, then its fields must also all be (recursively) mutable.
Parameters
lhs | Data to be swapped with rhs. |
rhs | Data to be swapped with lhs. |
fn
void swap(T)(ref T lhs, ref T rhs) if (isBlitAssignable!T && !is(typeof(lhs.proxySwap(rhs)))) @trusted pure nothrow @nogcditto