| Lecture 2 - Slide 11 : 29 |
An rvalue is an expression that is not an lvalue - an expression whose value does not have a fixed position in memory, such as a temporary object
double e = 3.14;
double d = f(5, e);
int i = 5, k = i + 8;
bool b = Point{1,2} == Point{3,4};
double *pe = &3.14; // error: Cannot take the address of a 3.14
double *pd = &f(5, e); // error: Cannot take the address of a f(5, e)
int *pi = &(i + 8); // error: Cannot take the address of (i + 8) An expression (in a given context) is either an Lvalue or an Rvalue - not both