tmp/tmpeuru07qu/{from.md → to.md}
RENAMED
|
@@ -6,18 +6,16 @@ Expressions are categorized according to the taxonomy in Figure
|
|
| 6 |
<a id="fig:basic.lval"></a>
|
| 7 |
|
| 8 |
![Expression category taxonomy \[fig:basic.lval\]](images/valuecategories.svg)
|
| 9 |
|
| 10 |
- A *glvalue* is an expression whose evaluation determines the identity
|
| 11 |
-
of an object
|
| 12 |
- A *prvalue* is an expression whose evaluation initializes an object or
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
resources can be reused (usually because it is near the end of its
|
| 18 |
-
lifetime).
|
| 19 |
- An *lvalue* is a glvalue that is not an xvalue.
|
| 20 |
- An *rvalue* is a prvalue or an xvalue.
|
| 21 |
|
| 22 |
Every expression belongs to exactly one of the fundamental
|
| 23 |
classifications in this taxonomy: lvalue, xvalue, or prvalue. This
|
|
@@ -41,15 +39,15 @@ values. — *end note*]
|
|
| 41 |
|
| 42 |
[*Note 3*:
|
| 43 |
|
| 44 |
An expression is an xvalue if it is:
|
| 45 |
|
|
|
|
| 46 |
- the result of calling a function, whether implicitly or explicitly,
|
| 47 |
whose return type is an rvalue reference to object type [[expr.call]],
|
| 48 |
-
- a cast to an rvalue reference to object type
|
| 49 |
-
[[expr.dynamic.cast]], [[expr.static.cast]] [[expr.reinterpret.cast]],
|
| 50 |
-
[[expr.const.cast]], [[expr.cast]]),
|
| 51 |
- a subscripting operation with an xvalue array operand [[expr.sub]],
|
| 52 |
- a class member access expression designating a non-static data member
|
| 53 |
of non-reference type in which the object expression is an xvalue
|
| 54 |
[[expr.ref]], or
|
| 55 |
- a `.*` pointer-to-member expression in which the first operand is an
|
|
@@ -119,26 +117,26 @@ glvalue for that operand, the temporary materialization conversion
|
|
| 119 |
|
| 120 |
The discussion of reference initialization in [[dcl.init.ref]] and of
|
| 121 |
temporaries in [[class.temporary]] indicates the behavior of lvalues
|
| 122 |
and rvalues in other significant contexts.
|
| 123 |
|
| 124 |
-
Unless otherwise indicated [[dcl.type.
|
| 125 |
have complete type or the `void` type; if it has a class type or
|
| 126 |
-
(possibly
|
| 127 |
-
|
| 128 |
cv `void`.
|
| 129 |
|
| 130 |
-
[*Note 8*: A glvalue
|
| 131 |
Class and array prvalues can have cv-qualified types; other prvalues
|
| 132 |
always have cv-unqualified types. See [[expr.type]]. — *end note*]
|
| 133 |
|
| 134 |
An lvalue is *modifiable* unless its type is const-qualified or is a
|
| 135 |
function type.
|
| 136 |
|
| 137 |
[*Note 9*: A program that attempts to modify an object through a
|
| 138 |
-
nonmodifiable lvalue or through an rvalue is ill-formed
|
| 139 |
-
[[expr.post.incr]], [[expr.pre.incr]]
|
| 140 |
|
| 141 |
If a program attempts to access [[defns.access]] the stored value of an
|
| 142 |
object through a glvalue whose type is not similar [[conv.qual]] to one
|
| 143 |
of the following types the behavior is undefined:[^4]
|
| 144 |
|
|
@@ -150,8 +148,9 @@ of the following types the behavior is undefined:[^4]
|
|
| 150 |
If a program invokes a defaulted copy/move constructor or copy/move
|
| 151 |
assignment operator for a union of type `U` with a glvalue argument that
|
| 152 |
does not denote an object of type cv `U` within its lifetime, the
|
| 153 |
behavior is undefined.
|
| 154 |
|
| 155 |
-
[*Note 10*:
|
| 156 |
-
|
|
|
|
| 157 |
|
|
|
|
| 6 |
<a id="fig:basic.lval"></a>
|
| 7 |
|
| 8 |
![Expression category taxonomy \[fig:basic.lval\]](images/valuecategories.svg)
|
| 9 |
|
| 10 |
- A *glvalue* is an expression whose evaluation determines the identity
|
| 11 |
+
of an object or function.
|
| 12 |
- A *prvalue* is an expression whose evaluation initializes an object or
|
| 13 |
+
computes the value of an operand of an operator, as specified by the
|
| 14 |
+
context in which it appears, or an expression that has type cv `void`.
|
| 15 |
+
- An *xvalue* is a glvalue that denotes an object whose resources can be
|
| 16 |
+
reused (usually because it is near the end of its lifetime).
|
|
|
|
|
|
|
| 17 |
- An *lvalue* is a glvalue that is not an xvalue.
|
| 18 |
- An *rvalue* is a prvalue or an xvalue.
|
| 19 |
|
| 20 |
Every expression belongs to exactly one of the fundamental
|
| 21 |
classifications in this taxonomy: lvalue, xvalue, or prvalue. This
|
|
|
|
| 39 |
|
| 40 |
[*Note 3*:
|
| 41 |
|
| 42 |
An expression is an xvalue if it is:
|
| 43 |
|
| 44 |
+
- a move-eligible *id-expression* [[expr.prim.id.unqual]],
|
| 45 |
- the result of calling a function, whether implicitly or explicitly,
|
| 46 |
whose return type is an rvalue reference to object type [[expr.call]],
|
| 47 |
+
- a cast to an rvalue reference to object type
|
| 48 |
+
[[expr.type.conv]], [[expr.dynamic.cast]], [[expr.static.cast]], [[expr.reinterpret.cast]], [[expr.const.cast]], [[expr.cast]],
|
|
|
|
| 49 |
- a subscripting operation with an xvalue array operand [[expr.sub]],
|
| 50 |
- a class member access expression designating a non-static data member
|
| 51 |
of non-reference type in which the object expression is an xvalue
|
| 52 |
[[expr.ref]], or
|
| 53 |
- a `.*` pointer-to-member expression in which the first operand is an
|
|
|
|
| 117 |
|
| 118 |
The discussion of reference initialization in [[dcl.init.ref]] and of
|
| 119 |
temporaries in [[class.temporary]] indicates the behavior of lvalues
|
| 120 |
and rvalues in other significant contexts.
|
| 121 |
|
| 122 |
+
Unless otherwise indicated [[dcl.type.decltype]], a prvalue shall always
|
| 123 |
have complete type or the `void` type; if it has a class type or
|
| 124 |
+
(possibly multidimensional) array of class type, that class shall not be
|
| 125 |
+
an abstract class [[class.abstract]]. A glvalue shall not have type
|
| 126 |
cv `void`.
|
| 127 |
|
| 128 |
+
[*Note 8*: A glvalue can have complete or incomplete non-`void` type.
|
| 129 |
Class and array prvalues can have cv-qualified types; other prvalues
|
| 130 |
always have cv-unqualified types. See [[expr.type]]. — *end note*]
|
| 131 |
|
| 132 |
An lvalue is *modifiable* unless its type is const-qualified or is a
|
| 133 |
function type.
|
| 134 |
|
| 135 |
[*Note 9*: A program that attempts to modify an object through a
|
| 136 |
+
nonmodifiable lvalue or through an rvalue is ill-formed
|
| 137 |
+
[[expr.ass]], [[expr.post.incr]], [[expr.pre.incr]]. — *end note*]
|
| 138 |
|
| 139 |
If a program attempts to access [[defns.access]] the stored value of an
|
| 140 |
object through a glvalue whose type is not similar [[conv.qual]] to one
|
| 141 |
of the following types the behavior is undefined:[^4]
|
| 142 |
|
|
|
|
| 148 |
If a program invokes a defaulted copy/move constructor or copy/move
|
| 149 |
assignment operator for a union of type `U` with a glvalue argument that
|
| 150 |
does not denote an object of type cv `U` within its lifetime, the
|
| 151 |
behavior is undefined.
|
| 152 |
|
| 153 |
+
[*Note 10*: In C, an entire object of structure type can be accessed,
|
| 154 |
+
e.g., using assignment. By contrast, C++ has no notion of accessing an
|
| 155 |
+
object of class type through an lvalue of class type. — *end note*]
|
| 156 |
|