15,440
社区成员
发帖
与我相关
我的任务
分享
a,b,c=c,a,b
// TEMPLATE FUNCTION swap (from <algorithm>)
template<class _Ty> inline
void swap(_Ty& _Left, _Ty& _Right)
{ // exchange values stored at _Left and _Right
if (&_Left != &_Right)
{ // different, worth swapping
_Ty _Tmp = _Left;
_Left = _Right;
_Right = _Tmp;
}
}
void xchg(int* a, int* b)
{
int tmp = *a;
*a = *b;
*b = tmp;
}