Q1. What is universal reference?
IF a variable or parameter T&&
is declared to has type for some deduced type T
, that variable or parameter is a universal reference.
Q2. What is deduced Typet?
A2. Template parameter, Auto declaration, ect.
Q3. What is the type of universal reference?
- If the expression initializing a universal reference is an lvalue, the universal reference becomes an lvalue reference.
- If the expression initializing the Universal reference is a rvalue, the universal reference becomes an rvalue reference.
Q4. What is Lvalue (lvalue) and what is rvalue (right value)?
The C++11 standard generally specifies whether an expression was an lvalue or an rvalue on a case-by-case basis
This can usually be summed up as:
- If you can take the address of a expression, the expression is an lvalue.
- If the type of an expression was an lvalue reference (e.g.,
T&
or const T&
, etc.), then expression is a lvalue.
- Otherwise, the expression is an rvalue. Conceptually (and typically also in fact), rvalues correspond to temporary objects, such as those returned from functions or created through implicit type conversions. Most literal values is also rvalues.
C++11 Universal Reference