std.algorithm: Allow proxySwap-using swap overload to take by ref

This commit is contained in:
Vladimir Panteleev 2014-01-14 14:46:29 +00:00
parent 2e317d0c5d
commit 9e14a1f6ef

View file

@ -1995,7 +1995,7 @@ See_Also:
$(XREF exception, pointsTo)
*/
void swap(T)(ref T lhs, ref T rhs) @trusted pure nothrow
if (allMutableFields!T && !is(typeof(T.init.proxySwap(T.init))))
if (allMutableFields!T && !is(typeof(lhs.proxySwap(rhs))))
{
static if (hasElaborateAssign!T || !isAssignable!T)
{
@ -2039,7 +2039,7 @@ if (allMutableFields!T && !is(typeof(T.init.proxySwap(T.init))))
}
// Not yet documented
void swap(T)(T lhs, T rhs) if (is(typeof(T.init.proxySwap(T.init))))
void swap(T)(ref T lhs, ref T rhs) if (is(typeof(lhs.proxySwap(rhs))))
{
lhs.proxySwap(rhs);
}