Swap operator ?

Jascha Wetzel firstname at mainia.de
Wed Oct 10 11:05:56 PDT 2007


BLS wrote:
> Not really nessesary, but nice to have...
> int a = 1;
> int b = 2;
> a <=> b // a == 2, b == 1

i use:

void swap(T)(ref T a, ref T b) {
   T t = a;
   a = b;
   b = t;
}

int a = 1;
int b = 2;
swap(a,b);



More information about the Digitalmars-d mailing list