template <typename T>
void f(paramTyep param);
f(expr);
template <typename T>
void f(T& param);//T& 参数类型
int x = 0;
const int cx = x;
const int& rx = x; //rx是别名
f(x); //调用 f(int&)
f(cx);//调用f(const int&)
f(rx);//调用f(const int&)
void f(const T& param);//const T& 参数类型
f(x); //调用 f(const int&)
f(cx);//调用f(const int&)
f(rx);//调用f(const int&)
template <typename T>
void f(T* param) // param 是一个指针
f(&x) //T是int ,param 类型是 int*
f(px);T是const int参数类型是 const int*
参数类型是万能引用
template <typename T>
void f(T&& param) // param 是万能引用,既可以传递左值,又可以传递右值
int x = 1;
f(x);x 是一个值,T是Int&,类型是int&
f(1);1