lvalue

suggest change

An lvalue is a glvalue that is not an xvalue. It has identity and is not, by itself, something you can move from. A return of a local automatic object is still treated as an rvalue, so that object can be moved from implicitly. Lvalues include names of variables and functions, uses of the built-in dereference operator, and calls that return an lvalue reference.

The typical lvalue is simply a name, but lvalues can come in other flavors as well:

struct X { ... };

X x;         // x is an lvalue
X* px = &x;  // px is an lvalue
*px = X{};   // *px is also an lvalue, X{} is a prvalue

X* foo_ptr();  // foo_ptr() is a prvalue
X& foo_ref();  // foo_ref() is an lvalue

Additionally, while most literals (e.g. 4, 'x', etc.) are prvalues, string literals are lvalues.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents