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
和表達式完全相同的類型