Added swap and list swap to stdlib.

This commit is contained in:
Christoffer Lerno
2022-07-14 14:58:11 +02:00
parent 3f6b0646b3
commit a68efec5e8
2 changed files with 11 additions and 0 deletions

View File

@@ -27,6 +27,13 @@ macro void @scope(&variable; @body) @autoimport
@body();
}
macro void @swap(&a, &b) @autoimport
{
$typeof(a) temp = a;
a = b;
b = temp;
}
/**
* Convert a variant type to a type, returning an failure if there is a type mismatch.
*