Result of a prvalue

Viewed 290

[basic.lval]/5 states:

The result of a prvalue is the value that the expression stores into its context. A prvalue whose result is the value V is sometimes said to have or name the value V. The result object of a prvalue is the object initialized by the prvalue; a non-discarded prvalue that is used to compute the value of an operand of a built-in operator or that has type cv void has no result object...

What does "stores into its context" mean? That the one part that I don't understand.

1 Answers

Well, for one there's [basic.lval]/1.2 that mentions those contexts

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.

prvalues under the changes in C++17 aren't values per se (guaranteed copy elision), but are rather akin to "instructions" for the delayed initialization of objects (either named or temporary). The initialization is delayed for as late as possible, that's how copies are "elided" (but I digress). The wording "stores into its context" means the result is what those instructions produce for the initialization of these objects in their respective contexts.

Related