Use
std::swap[
^]
or if you're set on doing this using the preprocessor:
#define SWAP(a,b,c) do {c t=a; a=b; b=t;}while(0)
The
do while
construct ensures that you can do something like this:
if(x < y)
SWAP(x,y,int);
else
y++;
Without undesired side effects - I would advice you to use std::swap.
Best regards
Espen Harlinn