reference types defines a reference type as "an alias to a already-existing object". in other words, a pointer that is dereferenced by default.
there are two kinds of references: l-value T& var; and r-value T&& var;.
but what is an l-value and r-value?

value categories

1960's programming language CLP introduced the idea of distinct semantics for values that are either on the right side, or the left side of an assignment.

l-value = r-value

modern cpp defines the categories of values to be based on two attributes: its identity, and move semantics.
the categories derived from this base are:


) its address can be taken by the operator &.
) if modifiable, it can be used as the left side operand of =.
) it can initialize another l-value.

assign += ments;
ter ? na : ry
"string literal"

pr-value (pure r-value)

an expression that evaluates to either the result of an operator, or a result object used to initialize an object.

x-value (expiring value):


) & cannot extract an address from it.
) cannot go on the left side of the operator =
) can be used to initialize a const l-value reference | r-value reference , etending the lifetime of the r-value until the end of the scope of the reference.
) invokes a function's overload that takes r-value reference over one that takes const l-value reference; (move constructor over copy constructor).

gl-value (generalized l-value)

its evaluation determines identity. the name of an object or function.