65,211
社区成员
发帖
与我相关
我的任务
分享double d = 3.44;
const int &i = d;
template<typename T1, typename T2>
void swap(T1& a, T2& b)
{
T1 t = a;
a = b;
b = t;
}
template<class Type>
void swap(
Type& _Left,
Type& _Right
);
a ^= b ^= a ^= b;
#include <iostream>
#include <string>
using namespace std;
typedef double swap_type;//想比较什么这里修改
void
swap (swap_type & a, swap_type & b)
{
swap_type temp;
temp = a;
a = b;
b = temp;
}
int
main ()
{
swap_type a = 100;
swap_type b = 200;
swap (a, b);
cout << a << "----" << b << endl;
return 0;
}