value_categories
Value categories
From talks: Anders Schau Knatten: lvalues, rvalues, glvalues, prvalues, xvalues, help!
- L-values: They represent expressions tied to identifiable memory locations. Use them when dealing with objects that have a name and a stable identity in memory.
- R-values: These are temporary and don't have an identifiable memory location. Use them for objects that are typically on the right-hand side of an expression and are not assigned to other variables.
- X-values (Expire L-values): These are L-values that are ready to be "moved from." Utilize X-values in situations where you have an object that still has an identity but is in a state to be moved, like with
std::move. - PR-values (Pure R-values): They represent pure right-hand side expressions, like temporary objects not bound to a name. Use them when dealing with temporaries.
- GL-values (Generalized L-values): These encompass both L-values and X-values, representing anything with an identity. They are used when the distinction between movable and non-movable is irrelevant.
Also: talk notes: Back to Basics: Understanding Value Categories - Ben Saks