4 ms·
Yes, section 8.2.1 "Value Category" (page 80) of the C++17 standard[0] defines the terms as: (1.1) - A glvalue is an expression whose evaluation determines the
by dbaupp 8y ago
Yes, section 8.2.1 "Value Category" (page 80) of the C++17 standard[0] defines the terms as:
(1.1) - A glvalue is an expression whose evaluation determines the identity of an object, bit-field, or function.
(1.2) - A prvalue is an expression whose evaluation initializes an object or a bit-field, or computes the value of the operand of an operator, as specified by the context in which it appears.
(1.3) - An xvalue is a glvalue that denotes an object or bit-field whose resources can be reused (usually because it is near the end of its lifetime).
(1.4) - An lvalue is a glvalue that is not an xvalue.
(1.5) - An rvalue is a prvalue or an xvalue.
It also has a diagram summarising it (equivalent to the one in the article, but the article's is clearer IMO):
expression
/ \
glvalue rvalue
/ \ / \
lvalue xvalue prvalue
Where every expression is in one of the three value categories in the bottom row.
[0]: available free as a late draft: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/n4713.pdf http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/n471...
- rocqua 8y agoThanks, I actually recall seeing that diagram. I agree that the article is clearer. Because I didn't get it when I saw that diagram, but I do get it after reading the article.