Function swap [src]
Exchanges contents of two memory locations.
Prototype
pub fn swap(comptime T: type, a: *T, b: *T) void
Parameters
T: type
a: *T
b: *T
Source
pub fn swap(comptime T: type, a: *T, b: *T) void {
const tmp = a.*;
a.* = b.*;
b.* = tmp;
}