Lvalue and Rvalue Overloads of a Template
Lvalue and Rvalue Overloads of a Template
Write two overloads of a function template identify:
- identify(T& value) prints Lvalue and a newline
- identify(T&& value) prints Rvalue and a newline
An lvalue is an expression that names a place you could assign to, such as a variable; an rvalue is a temporary result, such as a literal or the value of an addition. When both overloads could match, the T& version wins for lvalues, and the T&& version is the only match for rvalues. The tests start with int x = 5; and call identify with x, with 10, with x + 1, with ++x (pre-increment gives back the variable itself) and with x++ (post-increment gives back a temporary copy), then print x, so six lines are printed.
Do NOT write a main function.
Expected Output:
Lvalue Rvalue Rvalue Lvalue Rvalue 7
= newline. The output ends with a newline — print one after the last line.
Your Output
Run your code to see the output here...