On different resources I found different definitions of rvalue , lvalue . How correct?
right value or read value ?
left value or locator value ?
On different resources I found different definitions of rvalue , lvalue . How correct?
right value or read value ?
left value or locator value ?
Initially, it was about the left and right sides relative to the assignment operator. But the correct version of such a simple decoding is not and can not be. The terms will remain rvalue and lvalue . But what is the meaning embedded in them clearly spelled out in the standard . All this forms categories of expressions.
glvalue
An expression whose calculation determines the essence of an object, bit field, or function.
prvalue
An expression whose calculation initializes the object, a bit field, or calculates the value of the operand operator, according to the context of use.
xvalue
This is a glvalue , which denotes an object or bit field whose resources can be reused (usually because they are near the end of their lifetime).
lvalue
This is a glvalue , which is not xvalue .
rvalue
This is a prvalue or xvalue .
Thus, any expression is primarily lvalue , xvalue, or prvalue . rvalue is already a generalization.
A class that has been declared but not defined, an enumeration type in certain contexts (9.6), or an array of unknown bound or of incomplete element type, is an incompletely-defined object type. Incompletely-defined object types and cv void are incomplete types (6.7.1). Objects shall not be defined to have an incomplete type. A class that has been declared but not defined, an enumeration type in certain contexts (9.6), or an array of unknown bound or of incomplete element type, is an incompletely-defined object type. Incompletely-defined object types and cv void are incomplete types (6.7.1). Objects shall not be defined to have an incomplete type. - CroessmahI do not know what you mean by the question "how correctly". rvalue and lvalue are categories of expressions. Here is what is written in the standard:
- A bit-field, or function.
This is where the statement will appear.
- An xvalue is a field that can be reused (usually).
- An lvalue is a glvalue that is not an xvalue.
- An rvalue is a prvalue or an xvalue.// ...
[Note: Historically, lvalues ​​and rvalues ​​should be given the right side of the assignment (although this is no longer true); glvalues ​​are “generalized” lvalues, prvalues ​​are “pure” rvalues, and xvalues ​​are “eXpiring” lvalues. Despite their names, these terms classify expressions, not values. - end note]
Source: https://ru.stackoverflow.com/questions/863439/
All Articles