glvalue

suggest change

A glvalue (a “generalized lvalue”) expression is any expression which has identity, regardless of whether it can be moved from or not. This category includes lvalues (expressions that have identity but can’t be moved from) and xvalues (expressions that have identity, and can be moved from), but excludes prvalues (expressions without identity).

If an expression has a name, it’s a glvalue:

struct X { int n; };
X foo();

X x;
x; // has a name, so it's a glvalue
std::move(x); // has a name (we're moving from "x"), so it's a glvalue
              // can be moved from, so it's an xvalue not an lvalue

foo(); // has no name, so is a prvalue, not a glvalue
X{};   // temporary has no name, so is a prvalue, not a glvalue
X{}.n; // HAS a name, so is a glvalue. can be moved from, so it's an xvalue

Feedback about page:

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



Table Of Contents