template type deduction
reference or pointer
int x = 27;
const int cx = x;
const int& rx = x;
template<typename T>
void f(T& param);
int
:int&
const int
:const int&
const int
:const int&
template<typename T>
void f(const T& param);
int
:int&
int
:const int&
int
:const int&
Universal Reference
template<typename T>
void f(T&& param);
int&
:int&
const int&
:const int&
const int&
:const int&
f(27) ->
int
:int&&
Neither a Pointer nor a Reference
int
:int
int
:int
int
:int
- 数组作为参数按值传递时候,会转换为指针
auto
just like the T.
decltype
和表达式完全相同的类型