简体   繁体   English

prvalue的结果

[英]Result of a prvalue

[basic.lval]/5 states: [basic.lval] / 5个州:

The result of a prvalue is the value that the expression stores into its context. prvalue的结果是表达式存储到其上下文中的值。 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; 结果为值V的prvalue有时被称为具有或命名值V.prvalue的结果对象是由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... 用于计算内置运算符的操作数值或具有类型cv void的非丢弃的prvalue没有结果对象...

What does "stores into its context" mean? “存储到其上下文中”是什么意思? That the one part that I don't understand. 那部分我不明白。

Well, for one there's [basic.lval]/1.2 that mentions those contexts 好吧,有一个是[basic.lval] /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. prvalue是一个表达式,其求值初始化对象或位域,或计算运算符的操作数的值,由其出现的上下文指定。

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). C ++ 17中的变化下的prvalues本身不是值(保证副本省略),而是类似于对象(命名或临时)的延迟初始化的“指令”。 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. 措辞“存储到其上下文中”意味着结果是这些指令在各自的上下文中为这些对象的初始化而产生的结果。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM